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)
精彩评论