Superclass mismatch for class User (TypeError)?

≡放荡痞女 提交于 2020-01-05 09:34:43

问题


I have trouble with Heroku. I did heroku logs and got a error message:

/app/app/models/user.rb:1:in `<top (required)>': superclass mismatch for class User     (TypeError)

/app/app/models/user.rb:1:in `<top (required)>': superclass mismatch for class User     (TypeError)

2013-11-28T03:39:50.220378+00:00 app[web.1]:    from    
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:251:in `require'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:251:in `require'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:359:in `require_or_load'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:313:in `depend_on'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-
3.2.11/lib/active_support/dependencies.rb:225:in `require_dependency'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/engine.rb:438:in `each'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/engine.rb:436:in 
`eager_load!'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/engine.rb:438:in `block in 
eager_load!'
2013-11-28T03:39:50.220378+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/engine.rb:439:in `block (2 
levels) in eager_load!'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/application/finisher.rb:53:in 
`block in <module:Finisher>'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/initializable.rb:30:in 
`instance_exec'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/engine.rb:436:in `each'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/initializable.rb:54:in 
`run_initializers'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/application.rb:136:in 
`initialize!'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from /app/config/environment.rb:5:in 
`<top (required)>'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from /app/config.ru:3:in `require'
2013-11-28T03:39:50.220557+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block   
in run_initializers'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in 
`method_missing'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from /app/config.ru:in `new'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in 
`start' 
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-11-28T03:39:50.220696+00:00 app[web.1]:    from /app/config.ru:3:in `block in 
<main>'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from 
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from  
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in 
<top (required)>'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from   
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top 
(required)>'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from script/rails:6:in `require'
2013-11-28T03:39:50.221093+00:00 app[web.1]:    from script/rails:6:in `<main>'
2013-11-28T03:39:51.352167+00:00 heroku[web.1]: Process exited with status 1
2013-11-28T03:39:51.375056+00:00 heroku[web.1]: State changed from starting to crashed

I can't understand why I got this error because I have no /models/user.rb/. Yes. I actually made it once and removed it already.

Could you give me some advice?


回答1:


Look at

/app/app/models/user.rb

app/app? This is off. investigate your project source, you do indeed have a user.rb file




回答2:


I'm sure that this question is not actual for you. But for people who will search for a solution here I'd like just to mention one of possible reasons. I've got such an error while following "Rails Tutorial" by Michael Hartl. And in my case it was my inattention - I've placed file example_user.rb (from chapter 4.4.5 A user class) not in the root directory of application, but in controllers folder. After I've fixed that - that trouble with Heroku disappeared.



来源:https://stackoverflow.com/questions/20257484/superclass-mismatch-for-class-user-typeerror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!