Rails - Controllers

rails

How to use the generator to generate the controller for a resource?

bin/rails generate controller Comments

When we use the generator to generate the controller for a resource, what are the 7 files that get generated?

  1. app/controllers/comments_controller.rb: The Comments controller
  2. app/views/comments/: Views of the controller are stored here
  3. test/controllers/comments_controller_test.rb: The test for the controller
  4. app/helpers/comments_helper.rb: A view helper file
  5. test/helpers/comments_helper_test.rb: The test for the helper
  6. app/assets/javascripts/comment.js.coffee: CoffeeScript for the controller
  7. app/assets/stylesheets/comment.css.scss: Cascading style sheet for the controller
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License