阅读背景:

如何在Rails中将现有模型与新模型相关联

来源:互联网 

I have a 'tip' model and a 'team' model. I am trying to create a form where a user will select the winning teams from several games. So far the user can select the winning teams and those id's are being saved as foriegn keys in the Tip model (team_id). But after saving, I can't go (for example ) @tip.team.name . What do I need to do ? How do I associate it (I though rails might magically do it if foriegn key is set), I am very new to rails. Thanks for any help !I have a 'tip' model and a 'team' model. I am t




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: