Hi Josh!

There is a number of gems that can do this (or similar) thing for you:

- https://github.com/DmitryTsepelev/store_model
- https://github.com/palkan/store_attribute
- https://github.com/marshall-lee/nested_record

On Wednesday, 2 October 2019 05:23:14 UTC+3, Josh Marchello wrote:
> I'm considering starting a new PR to update ActiveRecord and wanted to 
> check here first to see if it is a viable feature. In Short I would like to 
> be able to define models for JSONB objects and have them supported as first 
> class associations just like foreign-key style associations. 
> This would provide the ability for developers to store objects in JSONB 
> while still enjoying the benefits of ActiveRecord such as association 
> validation. 
> I am currently attempting to accomplish this using ActiveModel::Model and 
> the Attributes API, but find a few things are more difficult to support 
> such as validating my JSONB objects when the "Parent" (the model they 
> 'belong_to') is saved.
> Tentatively I'm thinking of something like `has_many :posts, json: true` 
> or something like that, though of course I'm open to feedback in any 
> regard. 
> Would this be something I should look into or are there 
> technical/philosophical reasons why this would not work?  Thanks in advance.
> - Josh Marchello

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to