Skip to content

hirb errors with rails, devise and devise-two-factor #350

@DominikAlberski

Description

@DominikAlberski

When rails user model have scope returning only some columns hirb started to return errors

User.brief
  User Load (3.0ms)  SELECT "users"."id", "users"."email", "users"."firstname", "users"."lastname", "users"."on_commission", "users"."username", "users"."updated_at", "users"."created_at" FROM "users"
Hirb Error: missing attribute: encrypted_otp_secret

From what I understand attr_encrypted, is adding some sort of callbacks to attached model which couses hirb-error
after same investigation I've added:
return unless self.respond_to?(encrypted_attribute_name)
to:

define_method(attribute) do
        instance_variable_get("@#{attribute}") || instance_variable_set("@#{attribute}", decrypt(attribute, send(encrypted_attribute_name)))
      end

Which solved my problem but I'm not sure if this is really the correct place for that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions