1

Hartl の RoR チュートリアルの第 7 章を​​完了しました。すべての Spec テストに合格し、アプリは localhost で期待どおりに実行されます。しかし、アプリは Heroku でクラッシュしました。ログは意味がありません。Heroku の警告メッセージで示唆されているように、Ruby のバージョンを明示的に 1.9.3 に設定しましたが、違いはありませんでした。Heroku で実行する

Ruby -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 osman.uk.oa@gmail.com
> 2013-06-30T16:55:15.263331+00:00 heroku[api]: Release v12 created by
> osman.uk.oa@gmail.com 2013-06-30T16:55:15.300675+00:00 heroku[api]:
> Deploy b5a74ad by osman.uk.oa@gmail.com
> 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 章まではすべて正常に機能していました。したがって、どこかで私の学生のエラーに違いありませんが、エラーと Google 検索をデバッグする方法がわかりません。 「堅い」ものは何も与えないでください。

アドバイスをいただければ幸いです。

オズ


以下は、私のリポジトリへのリンクと User クラスの詳細を提供します。

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+\-.]+@[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

4

1 に答える 1

1

User問題は、クラスも定義する app/controllers/example_user.rb ファイルです。

開発モードでは、このファイルはおそらくロードされません。レールがユーザー クラスを見つけることを期待する場所ではありません。ただし、実稼働環境では、Rails はアプリ内のすべてのファイルを事前に読み込みます (少なくとも および で指定されたパス内のすべてのファイルeager_load_pathsがたまたま最初に読み込まれます)。

于 2013-07-01T07:13:04.110 に答える