2
Stubs out a new controller and its views. Pass the controller name, either
3
CamelCased or under_scored, and a list of views as arguments.
5
To create a controller within a module, specify the controller name as a
6
path like 'parent_module/controller_name'.
8
This generates a controller class in app/controllers, view templates in
9
app/views/controller_name, a helper class in app/helpers, a functional
10
test suite in test/functional and a helper test suite in test/unit/helpers.
13
`./script/generate controller CreditCard open debit credit close`
15
Credit card controller with URLs like /credit_card/debit.
16
Controller: app/controllers/credit_card_controller.rb
17
Functional Test: test/functional/credit_card_controller_test.rb
18
Views: app/views/credit_card/debit.html.erb [...]
19
Helper: app/helpers/credit_card_helper.rb
20
Helper Test: test/unit/helpers/credit_card_helper_test.rb
23
`./script/generate controller 'admin/credit_card' suspend late_fee`
25
Credit card admin controller with URLs /admin/credit_card/suspend.
26
Controller: app/controllers/admin/credit_card_controller.rb
27
Functional Test: test/functional/admin/credit_card_controller_test.rb
28
Views: app/views/admin/credit_card/debit.html.erb [...]
29
Helper: app/helpers/admin/credit_card_helper.rb
30
Helper Test: test/unit/helpers/admin/credit_card_helper_test.rb