Ok so I am building this rails app. I need a relationship between restaurants and dishes.
So restaurants has_many :dishes and dish belongs_to restaurant Problem is that the model is called dish and so it is called :dishes.. does this matter or does the name need to be (model_name)+s so dishs or is this totally irrelevant and this relationship is setk-up in my controller like I am thinking..
Rails has a number of built in plurals and rules. Dish ends in sh so it’s plural is dishes and this is what you should use.
If you fire up a rails console, you can check things with:
‘Dish’.pluralize #=>’Dishes’
If you don’t get the expected results, you can define your own plurals in config/initializers/inflections.rb (examples should already be there when you edit the file)