Why does minitest throw OptionParse::InvalidOption when rails generate is run with options?

StackOverflow https://stackoverflow.com/questions/8649704

  •  07-04-2021
  •  | 
  •  

Pregunta

Whenever the Rails generator is run with one or more options, mintiest raises OptionParse::InvalidOption.

I'm using Rails 3.1, Ruby 1.9.2-p290 and Mintest 2.10.0.

The generate command will actually run and process the passed option(s), but Minitest raises the exception and a stack trace at the end:

rails generate model x --no-migration -s -p

  invoke  active_record     
  identical    app/models/x.rb 
  invoke test_unit 
  identical      test/unit/x_test.rb 
  identical     test/fixtures/xs.yml

  /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:900:in 'block in process_args': invalid option: --no-migration (OptionParser::InvalidOption)       
  from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:879:in 'new'
  from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:879:in 'process_args'
  from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:929:in '_run'
  from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:922:in 'run'  
  from /Users/max/.rvm/gems/ruby-1.9.2-p290/gems/minitest-2.10.0/lib/minitest/unit.rb:690:in 'block in autorun'

Has anyone else come across this?

¿Fue útil?

Solución

As stated in the log - there is no such option --no-migration (which as far as I understand should be available) and that is why you are thrown an error. Try --skip-migration

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top