Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c7befb896e
Fetching contributors…

Cannot retrieve contributors at this time

31 lines (23 sloc) 1.401 kb
The controller generator creates stubs for a new controller and its views.
The generator takes a controller name and a list of views as arguments.
The controller name may be given in CamelCase or under_score and should
not be suffixed with 'Controller'. To create a controller within a
module, specify the controller name as 'module/controller'.
The generator creates a controller class in app/controllers with view
templates in app/views/controller_name, a helper class in app/helpers,
and a functional test suite in test/functional.
./script/generate controller CreditCard open debit credit close
Credit card controller with URLs like /credit_card/debit.
Controller: app/controllers/credit_card_controller.rb
Views: app/views/credit_card/debit.html.erb [...]
Helper: app/helpers/credit_card_helper.rb
Test: test/functional/credit_card_controller_test.rb
Modules Example:
./script/generate controller 'admin/credit_card' suspend late_fee
Credit card admin controller with URLs /admin/credit_card/suspend.
Controller: app/controllers/admin/credit_card_controller.rb
Views: app/views/admin/credit_card/debit.html.erb [...]
Helper: app/helpers/admin/credit_card_helper.rb
Test: test/functional/admin/credit_card_controller_test.rb
Jump to Line
Something went wrong with that request. Please try again.