Msan Msan wrote in post #1060411:
> Tell me if this is correct:
>
> I have a Shop, a Bar and OtherShop.
> Everyone have a Category.
> So I can create a polymorphic association:
>
> Shop has_many :categories, :as => categorization
> Bar has_many :categories, :as => categorization
> OtherShop has_many :categories, :as => categorization
>
>
> Category belongs_to :categorization, :polymorphic => true
>
>
> Is it the same if I do:
>
> Shop has_many :categories
> Bar has_many :categories
> OtherShop has_many :categories
>
> Category
> belongs_to :shop
> belongs_to :bar
> belongs_to :other_shop
>
> What's the difference using polymorphic?.

It's simple enough for you to try both in a quick prototype and find out 
for yourself. Doing it yourself would also make it more clear to you 
than us trying to explain it to you.

Besides the answer is right here in this guide:
http://guides.rubyonrails.org/association_basics.html#polymorphic-associations

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to