Rails multiple associations between two models

微笑、不失礼 提交于 2019-11-30 19:40:25

Do your pilots have types? like a pilot_type column? I just also started reading into these kinds of patterns and luckily it's still a bit fresh(hopefully. please correct me if Im wron rails ninjas! :))

You are in need of the polymorphic pattern as discussed here:

http://asciicasts.com/episodes/154-polymorphic-association

I've been told that the association between these models is set correctly.

I added a new record to the flights table, and now the associations work correctly with this new record and all the previous ones. I'm not really sure how it is working now, but it sure does.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!