应用程序错误。 Heroku部署

时间:2016-10-01 10:18:53

标签: ruby-on-rails heroku

伙计我按照步骤将我的网站上传到Heroku,但我无法打开我的网站。任何的想法?这是我的日志。

我收到此错误

应用程序错误 应用程序中发生错误,无法提供您的页面。请稍后再试。

如果您是应用程序所有者,请查看日志以获取详细信息。

2016-10-01T10:06:36.169967+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:282:in `start'
2016-10-01T10:06:36.169968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
2016-10-01T10:06:36.169968+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:79:in `start'
2016-10-01T10:06:36.169971+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
2016-10-01T10:06:36.169971+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
2016-10-01T10:06:36.169972+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2016-10-01T10:06:36.169974+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
2016-10-01T10:06:36.169975+00:00 app[web.1]:    from bin/rails:4:in `require'
2016-10-01T10:06:36.169975+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2016-10-01T10:06:36.275138+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-01T10:06:36.266024+00:00 heroku[web.1]: Process exited with status 1
2016-10-01T10:07:43.959981+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-basin-19893.herokuapp.com request_id=fb12e47e-dc0d-4729-90db-f89
24f36cf6c fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:07:46.067395+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-basin-19893.herokuapp.com request_id=651ac812-85be-4b
da-8f59-6d8f3498ddc3 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:07:51.057066+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-basin-19893.herokuapp.com request_id=0f410cc8-9fdc-45f1-8b25-723
9ff81a061 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:07:51.841094+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-basin-19893.herokuapp.com request_id=e5b2aadd-7102-4b
93-b1e9-fed57ffeff6d fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:08:24.115723+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-basin-19893.herokuapp.com request_id=0dde22ce-9c0d-4ca4-bcc5-7aa
0b968d952 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:08:25.240382+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-basin-19893.herokuapp.com request_id=1fc43b60-4eb6-41
2d-9aec-d889b5f0d8b8 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:09:32.710032+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-basin-19893.herokuapp.com request_id=29d89e0a-bc13-4670-99c9-fbe
c2f02c106 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:09:33.810413+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-basin-19893.herokuapp.com request_id=3127fe25-4f81-4e
56-96eb-4cbb4f5470a5 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:14:53.103026+00:00 heroku[web.1]: State changed from crashed to starting
2016-10-01T10:14:56.111168+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 14306 -e production`
2016-10-01T10:14:59.498769+00:00 app[web.1]: => Booting Puma
2016-10-01T10:14:59.498833+00:00 app[web.1]: => Rails 5.0.0.1 application starting in production on http://0.0.0.0:14306
2016-10-01T10:14:59.498860+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-10-01T10:15:00.116483+00:00 app[web.1]: /app/app/controllers/visitor_permits_controller.rb:18: warning: else without rescue is useless
2016-10-01T10:15:00.800902+00:00 app[web.1]: Exiting
2016-10-01T10:15:00.801090+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': No such file to load -- t
est_helper (LoadError)
2016-10-01T10:15:00.801104+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
2016-10-01T10:15:00.801117+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
2016-10-01T10:15:00.801128+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
2016-10-01T10:15:00.801140+00:00 app[web.1]:    from /app/app/models/user_test.rb:1:in `<top (required)>'
2016-10-01T10:15:00.801151+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
2016-10-01T10:15:00.801163+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
2016-10-01T10:15:00.801174+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
2016-10-01T10:15:00.801186+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
2016-10-01T10:15:00.801204+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:380:in `block in require_or_load'
2016-10-01T10:15:00.801216+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:37:in `block in load_interlock'
2016-10-01T10:15:00.801228+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
2016-10-01T10:15:00.801240+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/concurrency/share_lock.rb:117:in `exclusive'
2016-10-01T10:15:00.801256+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies/interlock.rb:11:in `loading'
2016-10-01T10:15:00.801268+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:37:in `load_interlock'
2016-10-01T10:15:00.801280+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:358:in `require_or_load'
2016-10-01T10:15:00.801291+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:336:in `depend_on'
2016-10-01T10:15:00.801306+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:252:in `require_dependency'
2016-10-01T10:15:00.801317+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
2016-10-01T10:15:00.801329+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:475:in `each'
2016-10-01T10:15:00.801340+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:475:in `block in eager_load!'
2016-10-01T10:15:00.801352+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:473:in `each'
2016-10-01T10:15:00.801363+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:473:in `eager_load!'
2016-10-01T10:15:00.801374+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:354:in `eager_load!'
2016-10-01T10:15:00.801385+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `each'
2016-10-01T10:15:00.801396+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
2016-10-01T10:15:00.801424+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
2016-10-01T10:15:00.801411+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
2016-10-01T10:15:00.801435+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
2016-10-01T10:15:00.801446+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
2016-10-01T10:15:00.801457+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
2016-10-01T10:15:00.801468+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
2016-10-01T10:15:00.801479+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
2016-10-01T10:15:00.801490+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:345:in `each'
2016-10-01T10:15:00.801501+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:345:in `call'
2016-10-01T10:15:00.801512+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
2016-10-01T10:15:00.801523+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
2016-10-01T10:15:00.801534+00:00 app[web.1]:    from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
2016-10-01T10:15:00.801545+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
2016-10-01T10:15:00.801557+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
2016-10-01T10:15:00.801572+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2016-10-01T10:15:00.801589+00:00 app[web.1]:    from /app/config.ru:3:in `require_relative'
2016-10-01T10:15:00.801605+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2016-10-01T10:15:00.801617+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
2016-10-01T10:15:00.801628+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
2016-10-01T10:15:00.801653+00:00 app[web.1]:    from /app/config.ru:in `new'
2016-10-01T10:15:00.801752+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2016-10-01T10:15:00.801765+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
2016-10-01T10:15:00.801776+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
2016-10-01T10:15:00.801787+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
2016-10-01T10:15:00.801798+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
2016-10-01T10:15:00.801810+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
2016-10-01T10:15:00.801821+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:59:in `app'
2016-10-01T10:15:00.801832+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
2016-10-01T10:15:00.801855+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/server.rb:79:in `start'
2016-10-01T10:15:00.801843+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/server.rb:282:in `start'
2016-10-01T10:15:00.801866+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
2016-10-01T10:15:00.801877+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
2016-10-01T10:15:00.801889+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
2016-10-01T10:15:00.801900+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2016-10-01T10:15:00.801922+00:00 app[web.1]:    from bin/rails:4:in `require'
2016-10-01T10:15:00.801911+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
2016-10-01T10:15:00.801934+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2016-10-01T10:15:00.963075+00:00 heroku[web.1]: Process exited with status 1
2016-10-01T10:15:00.981253+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-01T10:15:01.641973+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-basin-19893.herokuapp.com request_id=2e381d2e-dae6-48cd-a538-11b
e273e5e95 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:15:02.715647+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-basin-19893.herokuapp.com request_id=6f71493d-c680-4f
ce-8e86-ee343ce4d90a fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:15:40.496226+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by leechunvoo@gmail.com
2016-10-01T10:15:43.381875+00:00 heroku[run.2762]: Awaiting client
2016-10-01T10:15:43.428171+00:00 heroku[run.2762]: Starting process with command `bundle exec rake db:migrate`
2016-10-01T10:15:43.657102+00:00 heroku[run.2762]: State changed from starting to up
2016-10-01T10:15:48.751122+00:00 heroku[run.2762]: Process exited with status 0
2016-10-01T10:15:48.802610+00:00 heroku[run.2762]: State changed from up to complete
2016-10-01T10:15:55.874848+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=safe-basin-19893.herokuapp.com request_id=2b897bed-3553-416e-904d-d06
ae92bcc8e fwd="60.242.10.208" dyno= connect= service= status=503 bytes=
2016-10-01T10:15:58.077833+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=safe-basin-19893.herokuapp.com request_id=47c29d1f-d4c6-46
78-a4db-cbde4c3fd961 fwd="60.242.10.208" dyno= connect= service= status=503 bytes=

这是我从heroku运行rails控制台获取的日志

Running rails console on safe-basin-19893... up, run.2536 (Free)
/app/app/controllers/visitor_permits_controller.rb:18: warning: else without rescue is useless
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require': No such file to load -- test_helper (LoadError)
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
        from /app/app/models/user_test.rb:1:in `<top (required)>'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:380:in `block in require_or_load'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:37:in `block in load_interlock'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/concurrency/share_lock.rb:117:in `exclusive'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:37:in `load_interlock'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:358:in `require_or_load'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:336:in `depend_on'
        from /app/vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:252:in `require_dependency'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:475:in `each'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:475:in `block in eager_load!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:473:in `each'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:473:in `eager_load!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:354:in `eager_load!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `each'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:345:in `each'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:345:in `call'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
        from /app/vendor/ruby-2.2.4/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
        from /app/config/environment.rb:5:in `<top (required)>'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:328:in `require'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:328:in `require_environment!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:157:in `require_application_and_environment!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:77:in `console'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from /app/vendor/bundle/ruby/2.2.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
        from /app/bin/rails:4:in `require'
        from /app/bin/rails:4:in `<main>'

访客许可控制器

class VisitorPermitsController < ApplicationController
    before_action :set_vpermit, only: [:show, :destroy]
    def index
      @vpermit = VisitorPermit.all
    end

    def new
      @vpermit = VisitorPermit.new
    end

    def create
        @vpermit = VisitorPermit.new(vpermit_params)
        if @vpermit.save
          redirect_to @vpermit
        end
      else

      end


    def destroy
      VisitorPermit.destroy_all(user_id: current_user)
      respond_to do |format|
        format.html { redirect_to root_path, notice: 'Permit was successfully canceled.' }
        format.json { head :no_content }
      end
    end

    def show
      @vpermit = VisitorPermit.find(params[:id])
    end

    def update
      @vpermit = VisitorPermit.where(user_id: current_user).take
      respond_to do |format|
        if @vpermit.update(vpermit_params)
          format.html { redirect_to root_path}
          flash[:success] = "Permit successfully updated"
          format.json { render :show, status: :ok, location: @vpermit }
        else
          format.html { render :edit }
          format.json { render json: @vpermit.errors, status: :unprocessable_entity }
        end
      end
    end

    private
    # Use callbacks to share common setup or constraints between actions.
    def set_vpermit
      @vpermit = VisitorPermit.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def vpermit_params
      params.require(:visitor_permit).permit(:vehicle_type, :name, :department, :carplate, :duration, :permitstart, :permitend)
    end
  end

1 个答案:

答案 0 :(得分:1)

您遇到的问题是网络dyno上的网络dyno崩溃或启动超时。

通常有一些方法可以解决这个问题。

  • 尝试在终端中运行heroku restart,这会停止所有dynos并再次启动它们

  • 您也可以在终端中运行$heroku run rails console 从那里给你一个更详细的错误记录 可以修复错误或更新您的问题。

  • 您可以通过运行:heroku ps:scale web=0缩小和缩放dynos然后等待几秒钟并运行heroku ps:scale web=1

  • 您还可以尝试heroku run rake db:migrate然后heroku restart

如果您收到更详细的日志,请编辑您的问题并将其添加到

编辑:

问题出在您的控制器中

此方法:

def create
    @vpermit = VisitorPermit.new(vpermit_params)
    if @vpermit.save
      redirect_to @vpermit
    end
   else
end

应该是:

def create
    @vpermit = VisitorPermit.new(vpermit_params)
    if @vpermit.save
      redirect_to @vpermit
    else
      # Should enter an action here for else
    end
end

因为你不能在if / else语句的中间结束