Replies: 1 comment
-
Hi! Thanks for your note! I'm the author and maintainer of this gem! I have considered this before! For use cases like yours, yeah. When I've looked at it before, it's looked pretty difficult -- in trying to follow ActiveRecord/ActiveModel conventions to look as much like one of those as possible, the way those work, a LOT is stored at the Class level statically, and set up basically at Class load time. Rails has changed some of the way it does things since I last looked, but I'm not optimistic. The best idea I had was actually creating new anonymous classes at runtime... but I'm not sure that would work out either, especially changing them without restarting the app, as you would want to do for that use case. So I get why you want to do this, and I've tried looking into it before too, but haven't gotten anywhere, and am sadly not optimistic. I don't myself anticipate spending a ton of time pursuing this goal in the near future, but if you or anyone else does and makes any findings, definitely let us know! it's also worth being aware of: #234 If I can figure out how, I am going to turn this Issue into a Discussion. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I was thinking - would that be possible to somehow define attr_jsons on record on runtime rather than defining them in advance on model definition?
Something like:
In my current setup, every customer (tenant) of my app can define his own set of custom fields for "Project" model therefore i can't have them defined globally, i have to be able to re-load whatever custom fields tenant has defined on every target record load.
Also, i'm totally okay with some
#send(:private_method)
hacking or any sort of hacking to make that work :)Beta Was this translation helpful? Give feedback.
All reactions