rails HABTM migrations
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 ...
开发者_JS百科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?
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
精彩评论