如何修复我的git推送错误?我搞砸了吗?

时间:2013-04-09 08:46:57

标签: ruby-on-rails git heroku github

到目前为止,我在部署应用时遇到的问题很少。 但是,在今晚部署之后,我得到了一个无法修复的应用程序错误。所以我从一周前开始从 v7 回滚到 v4 。该应用程序再次工作,但我决定尝试“git push heroku master -f” v5 ,我认为不会在 v7 上找到应用程序错误。不幸的是, v5 也给了我同样的错误。

之后,我尝试回滚到工作版 v4 ,但它仍然给了我一个错误。我尝试了另一个回滚,但它仍然给了我一个应用程序错误。然后我尝试从我的本地硬盘驱动器“git push heroku master -f” v4 (我知道有效),但它现在说“一切都是最新的”。

我从这里做什么?我的应用程序没有在heroku上工作,我不能做任何回滚甚至推送现在有效的版本。我怎样才能让它运转起来?我想重新部署 v4 ,这是一个工作版本,并逐段重写代码以回到当前级别。

在开发环境和rails server中查看时,一切正常 但是,这是我在运行rails server -e production

时得到的错误
Started GET "/" for 127.0.0.1 at 2013-04-09 02:09:49 -0700
Processing by StaticPagesController#home as HTML
Completed 500 Internal Server Error in 1ms

ActiveRecord::StatementInvalid (Could not find table 'users'):
  app/helpers/sessions_helper.rb:19:in `current_user'
  app/helpers/sessions_helper.rb:11:in `signed_in?'
  app/controllers/static_pages_controller.rb:3:in `home'




Started GET "/favicon.ico" for 127.0.0.1 at 2013-04-09 02:09:49 -0700

ActionController::RoutingError (No route matches [GET] "/favicon.ico"):
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `c
all'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `ca
ll'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `
call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
  rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
  rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
  rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
  rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `servi
ce'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/webrick/server.rb:191:in `block in
start_thread'

但是,使用heroku logs部署后得到的错误与控制器的Rails superclass mismatch error有关

2 个答案:

答案 0 :(得分:0)

您的部分日志表示您没有表users

  

ActiveRecord :: StatementInvalid(找不到表'用户'):
  app / helpers / sessions_helper.rb:19:in current_user'
app/helpers/sessions_helper.rb:11:in
signed_in?'
  app / controllers / static_pages_controller.rb:3:在'home'

您是否应用了迁移?如果没有,请尝试:

rake db:migrate

答案 1 :(得分:0)

这里有两个不相关的问题。 rails server -e production无效,因为您需要针对本地数据库的生产版本运行迁移,因此请执行以下操作:RAILS_ENV=production rake db:migrate

你的Heroku问题与此无关。您需要从heroku logs发布您的Heroku日志,以便任何人为您提供帮助。

此外,强制推送到Heroku的git不是你回滚版本的方式。你这样做:heroku releases:rollback [RELEASE]