K
K
kamchatkin2012-10-28 01:45:26
Ruby on Rails
kamchatkin, 2012-10-28 01:45:26

Rails g scaffold person creates a people controller. Why?

After executing:

$ rails generate scaffold person name:string description:text phone:string email:string

The person model and person controller should have been created, only the model is created with the correct name, and the controller is created under the name people, but works with the person model.
Than it can be caused?
$ rails generate scaffold person name:string description:text phone:string email:string
      invoke  active_record
      create    db/migrate/20121027223223_create_people.rb
      create    app/models/person.rb
      invoke    test_unit
      create      test/unit/person_test.rb
      create      test/fixtures/people.yml
      invoke  resource_route
       route    resources :people
      invoke  scaffold_controller
      create    app/controllers/people_controller.rb
      invoke    erb
      create      app/views/people
      create      app/views/people/index.html.erb
      create      app/views/people/edit.html.erb
      create      app/views/people/show.html.erb
      create      app/views/people/new.html.erb
      create      app/views/people/_form.html.erb
      invoke    test_unit
      create      test/functional/people_controller_test.rb
      invoke    helper
      create      app/helpers/people_helper.rb
      invoke      test_unit
      create        test/unit/helpers/people_helper_test.rb
      invoke  assets
      invoke    coffee
      create      app/assets/javascripts/people.js.coffee
      invoke    scss
      create      app/assets/stylesheets/people.css.scss
      invoke  scss
   identical    app/assets/stylesheets/scaffolds.css.scss

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Scat, 2012-10-28
@Scat

This has to do with name generation and Rails naming conventions. He creates a model with a name in a single number, but a table in the plural. Because some words in the English language in the plural sound differently, Rails has a dictionary on this subject, which just describes such bundles. People is just part of it. There are others out there, so that's ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question