Hi, Fistly, dont create a model with the name "Attribute". Some of the rails core methods uses "attributes" . Use something like "custom_attributes" .
Next, to make a model belong_to different models on the same foreign_key, Make sure you use polymorphic-associations <http://guides.rubyonrails.org/association_basics.html#polymorphic-associations> in rails. On Sat, Dec 27, 2014 at 6:47 AM, fmh <[email protected]> wrote: > Hi, > > It's possible to do this : > > models: > > - product has_many attributes > - user has_many attributes > - other_model has_many attributes > > > model attribute belongs to > > - product , but the foreign_key is not product_id but the mode name > (Product) stored in table attributes(id, name, model) > - user , but the foreign_key is not product_id but the mode name > (Product) stored in table attributes(id, name, model) > > I want associate the attributes model with whole model and not with single > record. > > thx > > > > -- > 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/e5498711-d424-42bf-bbed-aebedc3a64d1%40googlegroups.com > <https://groups.google.com/d/msgid/rubyonrails-talk/e5498711-d424-42bf-bbed-aebedc3a64d1%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAFKVRj-Qd2%2Bj2u1O7hXHbs0BzVdfb14zJrcjMkCH6FqG6AgsZw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

