i have many model that user want add or remove attribute dynamically example :
table / model : product (id, name, price, metadata (serialized column , hash) ) table /mode : other_model (id, name, xxx_attribute, , metadata (serialized column , hash) ) table / model : my_custom_fields (id, name , field_type , model (column contain model name) ) form and fields view are generate dynamically (with partial) i can do it by : class product < AR::Base serialize :metadata , Hash #i save all my custom attributes in metadata column def get_all_custom_attributes My_custom_field.find_by_model(self.class.name) end end but i need a properly way if there is one ;) Le samedi 27 décembre 2014 17:54:13 UTC+1, Colin Law a écrit : > > On 27 December 2014 at 16:19, fmh <[email protected] <javascript:>> wrote: > > thx, > > > > but with polymorphic associations, i always need to set a foreign key > > column, > > > > my need is to set only the column type (model name)... > > Explain the problem that you are trying to solve with this unusual > scheme. It may well be that there is a better way of solving it. > > Colin > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/abbe1fa5-07f2-4016-abab-9f788a2311df%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

