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

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

  •  07-04-2021
  •  | 
  •  

문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top