views:

24

answers:

1

From a practical and best practices perspective, should rails models that have HABTM association also have a defined model for example users_groups.rb. So, should you


script generate model ...

or simply


script generate migration ...

On one hand the join table is simply two fields and shouldn't have any methods of its own, on the other hand, in rails (model = table). So would it be wise to have it defined in models as well as in migrations?

+1  A: 

Hi as for me if you have has_and_belongs_to_many you don't need any model but if you use has_many+:through you'll need one

Bohdan Pohorilets