Ruby on Rails
Tuesday, June 26, 2018
Hey, I wrote a gem that lets you have attributes in an ActiveRecord model serialize to keys in a json hash serialized to Json. It supports casting/typing just like AR, arrays, models-within-models, form builders (including treating models-within-arrays-and-models like you treat associations), dirty tracking on a per-attribute basis for json-serialized attributes, and some very basic querying support (also across models-within-models).
-- It was possible, in surprisingly few lines of code and working so consistently with "normal" AR, only cause of the awesome work sgriffin and others did on the Attributes API stuff, and other Rails "internal" APIs. Rails gets a lot of complaints for it's architecture and legacy code (some deserved), but there's increasingly some really nice architecture in there to build off of.
So, you, dear reader, may be interested:
https://github.com/jrochkind/attr_json
Feedback of any sort very welcome.
Jonathan
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8cb844c6-13ce-48a2-a5fc-e19a5e1541a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment