Reputation:
For some reason when I ran rails generate resource admin
on my new Rails app, Rails generated a resource called admins
. Is there any reason for it doing this? I would like the resource to be called admin
, not admins
.
Here is the output of running rails generate resource admin
:
invoke active_record
create db/migrate/20130117002055_create_admins.rb
create app/models/admin.rb
invoke test_unit
create test/unit/admin_test.rb
create test/fixtures/admins.yml
invoke controller
create app/controllers/admins_controller.rb
invoke erb
create app/views/admins
invoke test_unit
create test/functional/admins_controller_test.rb
invoke helper
create app/helpers/admins_helper.rb
invoke test_unit
create test/unit/helpers/admins_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/admins.js.coffee
invoke scss
create app/assets/stylesheets/admins.css.scss
invoke resource_route
route resources :admins
Upvotes: 0
Views: 149
Reputation: 824
Rails follows a plural naming convention by default if you wish to override this you can use custom inflection rules or edit the enviroment.rb
file both ways can be found in "How do I override rails naming conventions?".
Upvotes: 2