Rails Apartment gem error生成模型

时间:2017-05-15 23:50:09

标签: ruby-on-rails ruby apartment-gem

我正在使用Apartment gem构建多租户应用程序。但是,当我是脚手架或生成任何模型时,我收到以下错误:

rails g model Car name


/Users/palmeiras/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:35:in `build': undefined method `new' for "Apartment::Elevators::Domain":String
Did you mean?  next (NoMethodError)
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:99:in `block in build'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:99:in `each'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:99:in `inject'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:99:in `build'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/engine.rb:508:in `block in app'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/engine.rb:504:in `synchronize'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/engine.rb:504:in `app'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `run'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/initializable.rb:59:in `block in run_initializers'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/initializable.rb:58:in `run_initializers'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/railties-5.1.1/lib/rails/application.rb:353:in `initialize!'
    from /Users/codevops/dev/auto_repairs/config/environment.rb:5:in `<top (required)>'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:92:in `require'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:92:in `preload'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:143:in `serve'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:131:in `block in run'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `loop'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application.rb:125:in `run'
    from /Users/codevops/.rvm/gems/ruby-2.4.0/gems/spring-2.0.1/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/codevops/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from -e:1:in `<main>'

rails version 5.1.1

1 个答案:

答案 0 :(得分:0)

当您使用最新版本的rails(5.1.1)时,gem可能存在问题。 我建议你在github上提出这个问题:apartment gem