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
When rails user model have scope returning only some columns hirb started to return errors
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:
Which solved my problem but I'm not sure if this is really the correct place for that