Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

--force option in invalid option while rails g controller <glass> --force

#5967

Not sure if it is a bug or I am missing something.

I am getting following error with rails edge.

(master)$ rails g controller glass --force
   identical  app/controllers/glass_controller.rb
      invoke  erb
       exist    app/views/glass
      invoke  test_unit
   identical    test/functional/glass_controller_test.rb
      invoke  helper
   identical    app/helpers/glass_helper.rb
      invoke    test_unit
   identical      test/unit/helpers/glass_helper_test.rb
invalid option: --force
Test::Unit automatic runner.
Usage: script/rails [options] [-- untouched arguments]

    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], f[ox], g[tk], g[tk]2, t[k])
    -n, --name=NAME                  Runs tests matching NAME.
                                     (patterns may be used).
    -t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                     (patterns may be used).
    -I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
    -v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                     (s[ilent], p[rogress], n[ormal], v[erbose])
        --                           Stop processing options so that the
                                     remaining options will be passed to the
                                     test.
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).
        --gtk                        GTK runner (use --runner).
        --fox                        Fox runner (use --runner).

Help says --force should be a valid option.

$ rails g controller -h
Usage:
  rails generate controller NAME [action action] [options]

Options:
      [--helper]                # Indicates when to generate helper
                                # Default: true
      [--skip-namespace]        # Skip namespace (affects only isolated applications)
  -t, [--test-framework=NAME]   # Test framework to be invoked
                                # Default: test_unit
  -e, [--template-engine=NAME]  # Template engine to be invoked
                                # Default: erb

Runtime options:
  -q, [--quiet]    # Supress status output
  -f, [--force]    # Overwrite files that already exist
  -s, [--skip]     # Skip files that already exist
  -p, [--pretend]  # Run but do not make any changes

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 and invokes helper,
    template engine and test framework generators.

Example:
    `rails 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
Test::Unit automatic runner.
Usage: script/rails [options] [-- untouched arguments]

    -r, --runner=RUNNER              Use the given RUNNER.
                                     (c[onsole], f[ox], g[tk], g[tk]2, t[k])
    -n, --name=NAME                  Runs tests matching NAME.
                                     (patterns may be used).
    -t, --testcase=TESTCASE          Runs tests in TestCases matching TESTCASE.
                                     (patterns may be used).
    -I, --load-path=DIR[:DIR...]     Appends directory list to $LOAD_PATH.
    -v, --verbose=[LEVEL]            Set the output level (default is verbose).
                                     (s[ilent], p[rogress], n[ormal], v[erbose])
        --                           Stop processing options so that the
                                     remaining options will be passed to the
                                     test.
    -h, --help                       Display this help.

Deprecated options:
        --console                    Console runner (use --runner).
        --gtk                        GTK runner (use --runner).
        --fox                        Fox runner (use --runner).

Reported by Neeraj Singh · November 14th, 2010 @ 02:56 AM

State: stale
Milestone: 3.x
Assigned to: nobody
Importance: Low

Activity

  1. Neeraj Singh
    Neeraj Singh
    • State changed from new to open

    November 15th, 2010 @ 09:44 PM

  2. Aditya Sanghi
    Aditya Sanghi

    Cant reproduce it right now but i've seen this before on Ubuntu 10.04 when using runner in a Rails 2.3 app.

    I was using -e option which it didnt like and was somehow passing that option to this test::unit runner!

    November 16th, 2010 @ 03:06 PM

  3. rails
    rails

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 18th, 2011 @ 12:00 AM

  4. rails
    rails
    • State changed from open to stale

    February 18th, 2011 @ 12:00 AM

  5. bingbing