我剛剛完成了Hartl的RoR教程第7章。 所有Spec測試都通過了,應用程序按照預期在本地主機上運行。然而,該應用程序在Heroku上墜毀。日誌沒有任何意義。 根據Heroku警告消息的建議,我明確將Ruby版本設置爲1.9.3,但這沒有什麼區別。 在HerokuMichael Hartl:第7章 - 應用程序崩潰
運行它紅寶石-v給我1.9.3,日誌提示1.9.1
不知道這是張貼日誌的正確方法,但下面是Heroku的日誌的轉儲:
> 2013-06-30T16:52:30.721129+00:00 app[web.1]: => Booting WEBrick
> 2013-06-30T16:52:30.829645+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in
> `load_dependency' 2013-06-30T16:52:30.828830+00:00 app[web.1]: Exiting
> 2013-06-30T16:52:30.829645+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
> `require' 2013-06-30T16:52:30.829645+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
> `block in require' 2013-06-30T16:52:30.829645+00:00 app[web.1]:
> /app/app/models/user.rb:1:in `<top (required)>': superclass mismatch
> for class User (TypeError) 2013-06-30T16:52:30.829645+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in
> `require_or_load' 2013-06-30T16:52:30.829840+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in
> `require_dependency' 2013-06-30T16:52:30.829645+00:00 app[web.1]:
> from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
> `require' 2013-06-30T16:52:30.830407+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in
> `each' 2013-06-30T16:52:30.829645+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in
> `depend_on' 2013-06-30T16:52:30.830407+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in
> `each' 2013-06-30T16:52:30.830407+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in
> `eager_load!' 2013-06-30T16:52:30.830407+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:439:in
> `block (2 levels) in eager_load!' 2013-06-30T16:52:30.830565+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in
> `block in <module:Finisher>' 2013-06-30T16:52:30.830407+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in
> `block in eager_load!' 2013-06-30T16:52:30.830565+00:00 app[web.1]:
> from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in
> `block in run_initializers' 2013-06-30T16:52:30.830565+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
> `run_initializers' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
> `run' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
> `each' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
> `instance_exec' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in
> `initialize!' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
> `initialize' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
> `instance_eval' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/config.ru:3:in `require' 2013-06-30T16:52:30.830700+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in
> `eval' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/config/environment.rb:5:in `<top (required)>'
> 2013-06-30T16:52:30.830700+00:00 app[web.1]: from /app/config.ru:3:in
> `block in <main>' 2013-06-30T16:52:30.830565+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in
> `method_missing' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/config.ru:in `new' 2013-06-30T16:52:30.830838+00:00 app[web.1]:
> from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in
> `block in <top (required)>' 2013-06-30T16:52:30.830838+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in
> `start' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/config.ru:in `<main>' 2013-06-30T16:52:30.830700+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in
> `wrapped_app' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in
> `parse_file' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in
> `app' 2013-06-30T16:52:30.830700+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in
> `app' 2013-06-30T16:52:30.830838+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in
> `start' 2013-06-30T16:52:30.830838+00:00 app[web.1]: from
> script/rails:6:in `require' 2013-06-30T16:52:30.830838+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in
> `tap' 2013-06-30T16:52:30.830838+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in
> `<top (required)>' 2013-06-30T16:52:30.830838+00:00 app[web.1]: from
> script/rails:6:in `<main>' 2013-06-30T16:52:32.248386+00:00
> heroku[web.1]: Process exited with status 1
> 2013-06-30T16:52:32.258303+00:00 heroku[web.1]: State changed from
> starting to crashed 2013-06-30T16:54:22+00:00 heroku[slug-compiler]:
> Slug compilation started 2013-06-30T16:55:15.220931+00:00 heroku[api]:
> Deploy b5a74ad by [email protected]
> 2013-06-30T16:55:15.263331+00:00 heroku[api]: Release v12 created by
> [email protected] 2013-06-30T16:55:15.300675+00:00 heroku[api]:
> Deploy b5a74ad by [email protected]
> 2013-06-30T16:55:15.493971+00:00 heroku[web.1]: State changed from
> crashed to starting 2013-06-30T16:55:15+00:00 heroku[slug-compiler]:
> Slug compilation finished 2013-06-30T16:55:17.697516+00:00
> heroku[web.1]: Starting process with command `bundle exec rails server
> -p 48620` 2013-06-30T16:55:19.476876+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support
> for these plugins will be removed in Rails 4.0. Move them out and
> bundle them in your Gemfile, or fold them in to your app as
> lib/myplugin/* and config/initializers/myplugin.rb. See the release
> notes for more on this:
> http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released.
> (called from <top (required)> at /app/config/environment.rb:5)
> 2013-06-30T16:55:19.476876+00:00 app[web.1]: DEPRECATION WARNING: You
> have Rails 2.3-style plugins in vendor/plugins! Support for these
> plugins will be removed in Rails 4.0. Move them out and bundle them in
> your Gemfile, or fold them in to your app as lib/myplugin/* and
> config/initializers/myplugin.rb. See the release notes for more on
> this:
> http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released.
> (called from <top (required)> at /app/config/environment.rb:5)
> 2013-06-30T16:55:20.731749+00:00 app[web.1]: => Booting WEBrick
> 2013-06-30T16:55:20.731749+00:00 app[web.1]: => Call with -d to detach
> 2013-06-30T16:55:20.731749+00:00 app[web.1]: => Rails 3.2.13
> application starting in production on http://0.0.0.0:48620
> 2013-06-30T16:55:20.731749+00:00 app[web.1]: => Ctrl-C to shutdown
> server 2013-06-30T16:55:20.731749+00:00 app[web.1]: Connecting to
> database specified by DATABASE_URL 2013-06-30T16:55:20.815078+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
> `require' 2013-06-30T16:55:20.814340+00:00 app[web.1]: Exiting
> 2013-06-30T16:55:20.815078+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in
> `each' 2013-06-30T16:55:20.815078+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in
> `depend_on' 2013-06-30T16:55:20.815078+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
> `require' 2013-06-30T16:55:20.815078+00:00 app[web.1]:
> /app/app/models/user.rb:1:in `<top (required)>': superclass mismatch
> for class User (TypeError) 2013-06-30T16:55:20.815078+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
> `block in require' 2013-06-30T16:55:20.815078+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in
> `require_or_load' 2013-06-30T16:55:20.815078+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in
> `require_dependency' 2013-06-30T16:55:20.815078+00:00 app[web.1]:
> from
> /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in
> `load_dependency' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/config.ru:3:in `require' 2013-06-30T16:55:20.815283+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
> `run' 2013-06-30T16:55:20.815283+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in
> `block in run_initializers' 2013-06-30T16:55:20.815283+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
> `each' 2013-06-30T16:55:20.815078+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:439:in
> `block (2 levels) in eager_load!' 2013-06-30T16:55:20.815283+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in
> `each' 2013-06-30T16:55:20.815283+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:436:in
> `eager_load!' 2013-06-30T16:55:20.815283+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in
> `block in <module:Finisher>' 2013-06-30T16:55:20.815283+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:438:in
> `block in eager_load!' 2013-06-30T16:55:20.815283+00:00 app[web.1]:
> from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
> `run_initializers' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in
> `method_missing' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in
> `parse_file' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in
> `app' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/config.ru:3:in `block in <main>' 2013-06-30T16:55:20.815283+00:00
> app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
> `instance_exec' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/config/environment.rb:5:in `<top (required)>'
> 2013-06-30T16:55:20.815450+00:00 app[web.1]: from /app/config.ru:in
> `<main>' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in
> `start' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in
> `block in <top (required)>' 2013-06-30T16:55:20.815878+00:00
> app[web.1]: from script/rails:6:in `require'
> 2013-06-30T16:55:20.815878+00:00 app[web.1]: from script/rails:6:in
> `<main>' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in
> `start' 2013-06-30T16:55:20.815283+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in
> `initialize!' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
> `instance_eval' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in
> `app' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in
> `wrapped_app' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/config.ru:in `new' 2013-06-30T16:55:20.815878+00:00 app[web.1]:
> from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in
> `tap' 2013-06-30T16:55:20.815878+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in
> `<top (required)>' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in
> `initialize' 2013-06-30T16:55:20.815450+00:00 app[web.1]: from
> /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in
> `eval' 2013-06-30T16:55:21.891432+00:00 heroku[web.1]: Process exited
> with status 1 2013-06-30T16:55:21.903767+00:00 heroku[web.1]: State
> changed from starting to crashed
不用說是一個完整的新手日誌沒有意義,但一切工作正常,直到第7章,所以它一定是在我看齊小學生錯誤某處,但我不知道如何調試錯誤,谷歌搜索不給我任何「堅定」。
任何建議熱烈讚賞。
奧茲
下面提供了一個鏈接到我的回購和用戶類的細節:
https://github.com/OsmanAhmed/sample_app
以下是我的User類。我看看這一點,但什麼也看不到明顯的錯誤:
class User < ActiveRecord::Base
attr_accessible :name, :email, :password, :password_confirmation
has_secure_password
before_save { |user| user.email = user.email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.][email protected][a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: {with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
validates :password, presence: true, length: { minimum: 6 }
validates :password_confirmation, presence: true
after_validation { self.errors.messages.delete(:password_digest) }
end
不要擔心文件路徑中的紅寶石1.9.1 - 這是正常的,在紅寶石1.9.1和1.9.3之間ABI沒有改變 –
我假設你已經委託給Github嗎?你能提供鏈接到repo嗎?日誌表明你的用戶模型存在一些問題。 –
你可以粘貼用戶類嗎?日誌說超類不匹配類用戶(TypeError)' –