store_model icon indicating copy to clipboard operation
store_model copied to clipboard

Aliasing an attribute

Open ivanyv opened this issue 2 years ago • 1 comments

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.

ivanyv avatar Apr 28 '22 17:04 ivanyv

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

DmitryTsepelev avatar Apr 28 '22 20:04 DmitryTsepelev