store_model
store_model copied to clipboard
Aliasing an attribute
Is it possible to do something like this?
attribute :settings, Setting.to_type, alias: :user_settings
And then access the original jsonb through settings
, but user_settings
would return the StoreModel Object.
Simply aliasing the settings
method to user_settings
does not work.
Hi @ivanyv, I was going to suggest aliasing and surprized that it does not work 🙂We do not patch attribute
method yet (cause it comes from Attributes API) but I guess it won't be difficult if we know how to alias under the hood