You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to use store_accessor on models, the following is happening during encryption. This issue came up while attempting to upgrade to Rails 6.1. It is currently working on Rails 6.0.6.1 for us. 🤔
Expected behavior
A store attribute can be encrypted. Stored values can be read and written with accessors.
Actual behavior
When attempting to use a store accessor, an error is raised:
pp type_for_attribute(store_attribute).accessor
NoMethodError: undefined method `accessor' for #<ActiveModel::Type::Value:0x000055792c0d5ac0>
from (pry):3:in `store_accessor_for'
I can force the store_accessor_for method to return ActiveRecord::Store::IndifferentHashAccessor and my example spec here will pass. It's unclear to me what changed between Rails 6.0 and 6.1 that is triggering this change. I've poured over changelogs and issue reports on the Rails repo but have not been able to find anything (or more likely, I've looked at the right issue but lack the full understanding to tie it back to this problem 😆).
When trying to use
store_accessor
on models, the following is happening during encryption. This issue came up while attempting to upgrade to Rails 6.1. It is currently working on Rails 6.0.6.1 for us. 🤔Expected behavior
A store attribute can be encrypted. Stored values can be read and written with accessors.
Actual behavior
When attempting to use a store accessor, an error is raised:
Reproduction
Failing test branch at https://github.com/codeship/vault-rails/tree/rails-6.1
Possibly also related to rails/rails#43012
In looking at the
store_accessor_for
method, with Vault enabled, it returns:https://github.com/rails/rails/blob/v6.1.7.6/activerecord/lib/active_record/store.rb#L216-L218
System configuration
Rails version: 6.1.7.6
Ruby version: 2.7.8
vault-rails gem version: 0.9.0
The text was updated successfully, but these errors were encountered: