Forum: Ruby on Rails Documentation for generate controller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rover R. (Guest)
on 2005-12-22 19:50
I can find the API documentation, but where is the documentation for the
standard generators. The wiki has 3rd party generators- but I want to
know specifically what generate controller does, and how it differs from
generate scaffold, and what other generators there are.
Where is this succinctly documented?
Marcel Molina Jr. (Guest)
on 2005-12-22 21:17
(Received via mailing list)
On Thu, Dec 22, 2005 at 06:50:38PM +0100, rover rhubarb wrote:
> I can find the API documentation, but where is the documentation for the
> standard generators. The wiki has 3rd party generators- but I want to
> know specifically what generate controller does, and how it differs from
> generate scaffold, and what other generators there are.
> Where is this succinctly documented?

Run it with no arguments:

  ruby script/generate controller

marcel
Marcin Marjanski (Guest)
on 2005-12-22 21:50
(Received via mailing list)
Hi Rover,

You can get info of what buildin generatros are doing from the
generator script itself with the -h option:

[C:\rails\Projects\sa3]ruby script\generate -h controller
Usage: script/generate controller ControllerName [options]

General Options:
    -p, --pretend                    Run but do not make any changes.
    -f, --force                      Overwrite files that already exist.
    -s, --skip                       Skip files that already exist.
    -q, --quiet                      Suppress normal output.
    -t, --backtrace                  Debugging: show backtrace on
errors.
    -h, --help                       Show this help message.
    -c, --svn                        Modify files with subversion.
(Note: svn mu
st be in path)

Description:
    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.

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
        Views:      app/views/credit_card/debit.rhtml [...]
        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.rhtml [...]
        Helper:     app/helpers/admin/credit_card_helper.rb
        Test:       test/functional/admin/credit_card_controller_test.rb


Regards,

Marcin
This topic is locked and can not be replied to.