I have a problem generating a scaffold for a regatta. When i started
rails g scaffold Regatta name:string start_date:datetime
I get a model called regattum and a controller called regatta_controller (instead of regattas_controller)
invoke active_record create db/migrate/20110609221608_create_regatta.rb create app/models/regattum.rb invoke test_unit create test/unit/regattum_test.rb create test/fixtures/regatta.yml route resources :regatta invoke scaffold_controller create app/controllers/regatta_controller.rb invoke erb create app/views/regatta create app/views/regatta/index.html.erb create app/views/regatta/edit.html.erb create app/views/regatta/show.html.erb create app/views/regatta/new.html.erb create app/views/regatta/_form.html.erb invoke test_unit create test/functional/regatta_controller_test.rb invoke helper create app/helpers/regatta_helper.rb invoke test_unit create test/unit/helpers/regatta_helper_test.rb invoke stylesheets
identical to public / stylesheets / scaffold.css
Obviously this is a kink problem, but whenever I change /config/initializers/inflections.rb, I get an error:
The name 'Regatta' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again.
I tried everything I could think of to make it work, but I get an error all the time. Any advice on a solution or workaround would be greatly appreciated!
Update
Here are some of the things I've tried:
ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'regatta', 'regattas' end
This did not change anything, so I tried several options below, among others, in different combinations to no avail:
inflect.plural 'regatta', 'regattas' inflect.singular 'regattas', 'regatta' inflect.singular 'regatta', 'regatta'
Update 2
Here is the code I used in inflections.rb when I realized what I was doing wrong:
ActiveSupport::Inflector.inflections do |inflect| inflect.plural 'regatta', 'regattas' inflect.singular 'regatta', 'regatta' inflect.singular 'regattas', 'regatta' end
Hope this helps someone in the future!