开发者

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

开发者 https://www.devze.com 2023-02-05 04:04 出处:网络
Category.where(:name => params[:category]).joins(:business) Gets me: uninitialized constant Category::B开发者_Go百科usines
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

精彩评论

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