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
I can define a virtual attribute in an ActiveRecord model class like
defvirtual_attr
...
enddefvirtual_attr=(val)
...
end
It allows me to make calls like model.update(virtual_attr: 'Hi!')
When I try to do the same for a decorated model class it fails in internal _assign_attribute method. I think the reason is that it tries to do send(:virtual_attr=)for the model object and does not find such a method there.
What is the recommended way to create virtual attributes in decorator classes so that I could do decorated_model.update(virtual_attr: 'Hi!')?
The text was updated successfully, but these errors were encountered:
I can define a virtual attribute in an ActiveRecord model class like
It allows me to make calls like
model.update(virtual_attr: 'Hi!')
When I try to do the same for a decorated model class it fails in internal
_assign_attribute
method. I think the reason is that it tries to dosend(:virtual_attr=)
for the model object and does not find such a method there.What is the recommended way to create virtual attributes in decorator classes so that I could do
decorated_model.update(virtual_attr: 'Hi!')
?The text was updated successfully, but these errors were encountered: