开发者

Rails removing 's' off the word business as it thinks it is a plural?

Category.where(:name => params[:category]).joins(:business)

Gets me:

uninitialized constant Category::B开发者_Go百科usines

Why does it keep on missing an s off business or not detecting the model? I am sure it is me messing up here. : (


It ended up being that the pluralization of businesses had not been applied everywhere across my models and also the join needed to state

joins(:businesses)

Thank you for the comments as it made me look again in a different light at what I had written.


You'll want to specify the same name as the relation, in this case :businesses.

Category.where(:name => params[:category]).joins(:businesses)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜