instiki/vendor/rails/railties/lib/rails_generator/generators/components/controller/USAGE

30 lines
1.3 KiB
Plaintext
Raw Normal View History

2007-01-22 14:43:50 +01:00
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.
2007-01-22 14:43:50 +01:00
To create a controller within a module, specify the controller name as a
path like 'parent_module/controller_name'.
2007-01-22 14:43:50 +01:00
This generates a controller class in app/controllers, view templates in
app/views/controller_name, a helper class in app/helpers, and a functional
test suite in test/functional.
2007-01-22 14:43:50 +01:00
Example:
`./script/generate controller CreditCard open debit credit close`
2007-01-22 14:43:50 +01:00
Credit card controller with URLs like /credit_card/debit.
Controller: app/controllers/credit_card_controller.rb
Views: app/views/credit_card/debit.html.erb [...]
2007-01-22 14:43:50 +01:00
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`
2007-01-22 14:43:50 +01:00
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 [...]
2007-01-22 14:43:50 +01:00
Helper: app/helpers/admin/credit_card_helper.rb
Test: test/functional/admin/credit_card_controller_test.rb