Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DominikAlberski opened this issue Jul 2, 2019 · 0 comments
Open

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

DominikAlberski opened this issue Jul 2, 2019 · 0 comments

Comments

@DominikAlberski
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant