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
Using Rails 6.1 and combining the attribute_methods plugin from master with Model.select(:name) when you have other fields that are translateable, it would raise ActiveRecord::MissingAttributeError as you are not including those fields.
I.e.
Mobility.configure do
plugins do
backend :jsonb
ransack
dirty
active_record
fallbacks
reader
writer
query
cache
presence
default
attribute_methods
locale_accessors
end
end
class Model < ApplicationRecord
extend Mobility
translates(:name, :description)
end
> Model.select(:name)
ActiveRecord::MissingAttributes => :description
Expected Behavior
It should only depend on selected/valid fields
Actual Behavior
ActiveRecord::MissingAttributeError is being raised.
Possible Fix
Surströmming and disabling attribute_methods for now.
The text was updated successfully, but these errors were encountered:
Hmm ok this seems like a genuine bug. I'll try to have a look, honestly that plugin is kinda weird and I haven't done more than minimal maintenance on it.
Context
Using Rails 6.1 and combining the
attribute_methods
plugin from master withModel.select(:name)
when you have other fields that are translateable, it would raise ActiveRecord::MissingAttributeError as you are not including those fields.I.e.
Expected Behavior
It should only depend on selected/valid fields
Actual Behavior
ActiveRecord::MissingAttributeError is being raised.
Possible Fix
Surströmming and disabling
attribute_methods
for now.The text was updated successfully, but these errors were encountered: