开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜