Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aliasing an attribute #116

Open
ivanyv opened this issue Apr 28, 2022 · 1 comment
Open

Aliasing an attribute #116

ivanyv opened this issue Apr 28, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@ivanyv
Copy link

ivanyv commented Apr 28, 2022

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.

@DmitryTsepelev
Copy link
Owner

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 DmitryTsepelev added the enhancement New feature or request label Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants