Note that there are some explanatory texts on larger screens.

plurals
  1. PORails 3 Inflection Problem
    primarykey
    data
    text
    <p>I'm having a problem with generating scaffold for a Regatta. When I run </p> <pre><code>rails g scaffold Regatta name:string start_date:datetime </code></pre> <p>I get a model named regattum and a controller called regatta_controller (instead of regattas_controller)</p> <pre><code> 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 </code></pre> <p>identical public/stylesheets/scaffold.css</p> <p>Obviously this is an inflection problem, but whenever I modify /config/initializers/inflections.rb I get an error saying:</p> <pre><code>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. </code></pre> <p>I have tried everything I can think of to make it work, but I keep getting an error. Any advice on a solution or a workaround would be greatly appreciated!</p> <hr> <p><strong>Update</strong></p> <p>Here are some of the things I have tried:</p> <pre><code>ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'regatta', 'regattas' end </code></pre> <p>That didn't change anything so I tried a few of the options below, among others,in varying combinations to no avail:</p> <pre><code> inflect.plural 'regatta', 'regattas' inflect.singular 'regattas', 'regatta' inflect.singular 'regatta', 'regatta' </code></pre> <hr> <p><strong>Update 2</strong></p> <p>Here is the code I used in inflections.rb once I figured out what I was doing wrong:</p> <pre><code>ActiveSupport::Inflector.inflections do |inflect| inflect.plural 'regatta', 'regattas' inflect.singular 'regatta', 'regatta' inflect.singular 'regattas', 'regatta' end </code></pre> <p>Hopefully this will help someone out in the future!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload