【发布时间】:2019-05-21 14:07:17
【问题描述】:
我正在尝试在仅限 Rails API 的应用程序中创建新模型,但我收到“无法加载此类文件”错误消息:
/Users/max/.rvm/gems/ruby-2.6.3/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': cannot load such file -- rails/generators/model/model/model_generator (LoadError)
/Users/max/.rvm/gems/ruby-2.6.3/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
/Users/max/.rvm/gems/ruby-2.6.3/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `join' for nil:NilClass (NoMethodError)
/Users/max/.rvm/gems/ruby-2.6.3/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
/Users/max/.rvm/gems/ruby-2.6.3/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
/Users/max/.rvm/gems/ruby-2.6.3/gems/spring-2.0.2/lib/spring/application.rb:171:in `fork': undefined method `reject!' for nil:NilClass (NoMethodError)
我已经更改了 ruby 版本,但是没有用。
rails generate model Product title:string release_date:date release_time:time description:text price:decimal brand:string
【问题讨论】:
标签: ruby rubygems ruby-on-rails-5