I want to create a cafe and a cave controller.
When I try to create my cafe using rails scaffolding, via the command
rails g scaffold cafe name:string
It is deriving the plural form of “cafe” as “caves”, which means I can’t make my caves controller since the name is already used.
How can I make rails use the correct pluralisation?
You can create your own inflections.
Add this to your
config/initializers/inflections.rb(Restart your server after making this change. This is not required for the scaffolding command itself but it will be required when you want to actually view/use the code)
Now when you run
rails g scaffold cafeyou’ll get:This may help you: http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-inflections