导轨移除“s”;关闭“business”这个词,因为它认为它是复数形式?
Category.where(:name => params[:category]).joins(:business)
让我困惑:
uninitialized constant Category::Busines
为什么它总是错过业务或检测不到模型?我确信是我在这里搞砸了。 :(
Category.where(:name => params[:category]).joins(:business)
Gets me:
uninitialized constant Category::Busines
Why does it keep on missing an s off business or not detecting the model? I am sure it is me messing up here. : (
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
结果是,业务多元化并没有在我的模型中得到应用,而且还需要加入声明
感谢您的评论,因为它让我再次以不同的角度审视我所写的内容。
It ended up being that the pluralization of businesses had not been applied everywhere across my models and also the join needed to state
Thank you for the comments as it made me look again in a different light at what I had written.
您需要指定与关系相同的名称,在本例中为
:businesses
。You'll want to specify the same name as the relation, in this case
:businesses
.