-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
AR encryption breaks store
#43012
Comments
store_accessor
store
I think this method just needs to be updated to account for rails/activerecord/lib/active_record/store.rb Lines 216 to 218 in 6ec669b
Something like this? def store_accessor_for(store_attribute)
type_for_attribute_before_encryption(store_attribute).accessor
end
def type_for_attribute_before_encryption(name)
type_for_attribute(name).then { |type| type.try(:cast_type) || type }
end |
Thanks for the great report @georgeclaghorn 🙏. Fix in #43013. I think I prefer to delegate |
@jorgemanrubia @georgeclaghorn I think I'm running into a similar issue over on hashicorp/vault-rails#138. Any ideas on how I might fix or workaround that issue? Much appreciated if you happen to have a moment to look. 🙇 |
Reproduction script
Click to expand…
Expected behavior
A
store
attribute can be encrypted. Stored values can be read and written via accessors.Actual behavior
When attempting to read or write through a
store
accessor, an exception is raised:System configuration
Rails version: Latest
main
Ruby version: 3.0.1
/cc @jorgemanrubia
The text was updated successfully, but these errors were encountered: