~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/railties/lib/rails_generator/generators/components/controller/USAGE

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description:
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.
4
 
 
5
 
    To create a controller within a module, specify the controller name as a
6
 
    path like 'parent_module/controller_name'.
7
 
 
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.
11
 
 
12
 
Example:
13
 
    `./script/generate controller CreditCard open debit credit close`
14
 
 
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
21
 
 
22
 
Modules Example:
23
 
    `./script/generate controller 'admin/credit_card' suspend late_fee`
24
 
 
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