-
-
Notifications
You must be signed in to change notification settings - Fork 17
feat: register store_attributes as attributes #32
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
Conversation
Could you please provide an example of when it could be useful? I'm a bit concerned of potential incompatibilities, and in general it's questionable whether we should consider store attributes to be real attributes. I don't know. Maybe, we should make this feature optional and off by default. |
An example is that I would like to store I'd also very much like to be able to query on these attributes, fwiw. |
f33a4df
to
9109a92
Compare
Hey cool, this is exactly what I need. Right now we are using https://github.com/madeintandem/jsonb_accessor, but we need to move away from it because it's not longer maintained. We are iterating over all attributes on a model in order to do some token replacement in text.
That's my use case for needed data attributes to respond as attributes. Thanks! |
@hmasing @Petercopter Thanks for the details! Let's then proceed with this feature but make it opt-in for now; we can added a setting similar to class Post < ApplicationRecord
self.store_attribute_register_attributes = true
store_attribute :extra, :published_at, :datetime
end
Post.new.attributes.include?("published_at") #=> true @RickCSong Will you be able to add this change? If not I (or, maybe, someone else) can pick up from here, no worries. Thank you! |
Hey @palkan you haven't done this right? @RickCSong is a buddy and we can find someone to add the change you suggested! |
06838ae
to
dfe7aef
Compare
Enables better compatibility with other gems (i.e. StoreModel) which rely on attributes being registered on the model.
Also cleans up specs
Hey @4ndypanda,
Right. Feel free to pick up the PR! |
Hey @palkan the @RickCSong added the change you suggested to the PR - this is ready for rereview let us know if there's any other changes you need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good
Enables better compatibility with other gems (i.e. StoreModel) which rely on attributes being registered on the model.
Checklist