polymorphic associations or has_many?

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?.

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: