blob: 42d38bd745f7ac5ed3b731118883e424f71c17eb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
Description:
Stubs out a new controller and its views. Pass the controller name, either
CamelCased or under_scored, and a list of views as arguments.
To create a controller within a module, specify the controller name as a
path like 'parent_module/controller_name'.
This generates a controller class in app/controllers, view templates in
app/views/controller_name and then invokes the helper generator, the
current template engine and finally the test framework.
Example:
`./script/generate controller CreditCard open debit credit close`
Credit card controller with URLs like /credit_card/debit.
Controller: app/controllers/credit_card_controller.rb
Functional Test: test/functional/credit_card_controller_test.rb
Views: app/views/credit_card/debit.html.erb [...]
Helper: app/helpers/credit_card_helper.rb
Helper Test: test/unit/helpers/credit_card_helper_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
Functional Test: test/functional/admin/credit_card_controller_test.rb
Views: app/views/admin/credit_card/debit.html.erb [...]
Helper: app/helpers/admin/credit_card_helper.rb
Helper Test: test/unit/helpers/admin/credit_card_helper_test.rb
|