halois
halois

Reputation: 21

Heroku Deployment Ruby on Rails log error (cannot find my column variable?)

I am trying to deploy a ruby on rails project to Heroku. I successfully did this the first time but then I was trying to update jquery-turbolinks and somehow the entire application will no longer launch. Instead I simply have "something went wrong" error. I've reverted everything back to the original code but it seems I still cannot launch the application. I've tried to bundle update and heroku run rake db:migrate but these do not seem to fix the problem.

heroku logs say:

2015-06-17T22:57:00.131666+00:00 app[web.1]:
2015-06-17T22:57:00.687644+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=safe-dusk-1738.herokuapp.com request_id=ebbc37e0-825c-4c56-889e-93b40b0439f0 fwd="65.101.157.210" dyno=web.1 connect=1ms service=6ms status=304 bytes=133
2015-06-17T23:02:57.060664+00:00 heroku[slug-compiler]: Slug compilation started
2015-06-17T23:02:57.060684+00:00 heroku[slug-compiler]: Slug compilation finished
2015-06-17T23:02:57.005801+00:00 heroku[api]: Deploy 658b38c by [email protected]
2015-06-17T23:02:57.005801+00:00 heroku[api]: Release v48 created by [email protected]
2015-06-17T23:02:57.117163+00:00 heroku[web.1]: State changed from up to starting
2015-06-17T23:03:00.396169+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2015-06-17T23:03:01.250804+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 18412 -e production`
2015-06-17T23:03:01.190809+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2015-06-17T23:03:01.190799+00:00 app[web.1]: [2015-06-17 23:03:01] FATAL SignalException: SIGTERM
2015-06-17T23:03:01.190806+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2015-06-17T23:03:01.190816+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.4/lib/rack/server.rb:264:in `start'
2015-06-17T23:03:01.190812+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2015-06-17T23:03:01.190811+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2015-06-17T23:03:01.190820+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:81:in `block in server'
2015-06-17T23:03:01.190825+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2015-06-17T23:03:01.190814+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.4/lib/rack/handler/webrick.rb:14:in `run'
2015-06-17T23:03:01.190818+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.8/lib/rails/commands/server.rb:69:in `start'
2015-06-17T23:03:01.190827+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
2015-06-17T23:03:01.190822+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `tap' 2015-06-17T23:03:01.190824+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:76:in `server'
2015-06-17T23:03:01.192619+00:00 app[web.1]: [2015-06-17 23:03:01] INFO  WEBrick::HTTPServer#start done.
2015-06-17T23:03:01.190829+00:00 app[web.1]:    bin/rails:4:in `require'
2015-06-17T23:03:01.190830+00:00 app[web.1]:    bin/rails:4:in `<main>'
2015-06-17T23:03:01.192513+00:00 app[web.1]: [2015-06-17 23:03:01] INFO  going to shutdown ...
2015-06-17T23:03:01.192717+00:00 app[web.1]: Exiting
2015-06-17T23:03:02.390504+00:00 heroku[web.1]: Process exited with status 143
2015-06-17T23:03:05.130317+00:00 heroku[web.1]: State changed from starting to up
2015-06-17T23:03:05.072848+00:00 app[web.1]: [2015-06-17 23:03:05] INFO  WEBrick 1.3.1
2015-06-17T23:03:05.073257+00:00 app[web.1]: [2015-06-17 23:03:05] INFO  WEBrick::HTTPServer#start: pid=3 port=18412
2015-06-17T23:03:05.072881+00:00 app[web.1]: [2015-06-17 23:03:05] INFO  ruby 2.0.0 (2015-04-13) [x86_64-linux]
2015-06-17T23:37:45.403520+00:00 app[web.1]: => Rails 4.1.8 application starting in production on http://0.0.0.0:18412
2015-06-17T23:37:45.403516+00:00 app[web.1]: => Booting WEBrick
2015-06-17T23:37:45.403523+00:00 app[web.1]: => Run `rails server -h` for more startup options
2015-06-17T23:37:45.403527+00:00 app[web.1]: Started GET "/" for 65.101.157.210 at 2015-06-17 23:37:45 +0000
2015-06-17T23:37:45.403524+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2015-06-17T23:37:45.403526+00:00 app[web.1]: => Ctrl-C to shutdown server
2015-06-17T23:37:51.001585+00:00 app[web.1]: Processing by UsersController#index as HTML
2015-06-17T23:37:51.023671+00:00 heroku[router]: at=info method=GET path="/" host=safe-dusk-1738.herokuapp.com request_id=2dc68f54-45b7-4f1d-92ab-10ebb6ec6749 fwd="65.101.157.210" dyno=web.1 connect=2ms service=5671ms status=500 bytes=1754
2015-06-17T23:37:51.015670+00:00 app[web.1]:   Rendered partials/_navbar.html.erb (1.1ms)
2015-06-17T23:37:51.015741+00:00 app[web.1]:   Rendered users/index.html.erb within layouts/application (3.2ms)
2015-06-17T23:37:51.017553+00:00 app[web.1]: ActionView::Template::Error (undefined method `id' for nil:NilClass):
2015-06-17T23:37:51.017571+00:00 app[web.1]:
2015-06-17T23:37:51.017554+00:00 app[web.1]:     30:       </ul>
2015-06-17T23:37:51.017557+00:00 app[web.1]:     32:       <ul class="nav navbar-nav navbar-right">
2015-06-17T23:37:51.017565+00:00 app[web.1]:   app/views/partials/_navbar.html.erb:33:in `_app_views_partials__navbar_html_erb__120412911408632626_69924047825640'
2015-06-17T23:37:51.015890+00:00 app[web.1]: Completed 500 Internal Server Error in 14ms
2015-06-17T23:37:51.017563+00:00 app[web.1]:     36:           <ul class="dropdown-menu" role="menu">
2015-06-17T23:37:51.017556+00:00 app[web.1]:     31:       <!-- Right Side of Nav Bar -->
2015-06-17T23:37:51.017559+00:00 app[web.1]:     33:         <li><a href="#">Welcome back, <%[email protected]%></a></li>
2015-06-17T23:37:51.017562+00:00 app[web.1]:     35:           <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span class="caret"></span></a>
2015-06-17T23:37:51.017551+00:00 app[web.1]:
2015-06-17T23:37:51.017560+00:00 app[web.1]:     34:         <li class="dropdown">
2015-06-17T23:37:51.017569+00:00 app[web.1]:   app/views/users/index.html.erb:54:in `_app_views_users_index_html_erb__1269627799293070153_69924047657220'
2015-06-17T23:37:51.017570+00:00 app[web.1]:
2015-06-17T23:37:52.182325+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=safe-dusk-1738.herokuapp.com request_id=7857ae9b-7e46-4c6c-941c-52260c1a6622 fwd="65.101.157.210" dyno=web.1 connect=2ms service=4ms status=200 bytes=228
2015-06-17T23:38:49.323603+00:00 heroku[api]: Starting process with command `db:migrate` by [email protected]
2015-06-17T23:38:54.317178+00:00 heroku[run.9167]: Awaiting client
2015-06-17T23:38:54.345438+00:00 heroku[run.9167]: Starting process with command `db:migrate`
2015-06-17T23:38:54.624462+00:00 heroku[run.9167]: State changed from starting to up
2015-06-17T23:38:56.468635+00:00 heroku[run.9167]: State changed from up to complete
2015-06-17T23:38:56.455801+00:00 heroku[run.9167]: Process exited with status 127
2015-06-17T23:39:47.429999+00:00 heroku[api]: Starting process with command `bundle exec rake` by [email protected]
2015-06-17T23:39:51.479879+00:00 heroku[run.4407]: Awaiting client
2015-06-17T23:39:51.535925+00:00 heroku[run.4407]: Starting process with command `bundle exec rake`
2015-06-17T23:39:51.778399+00:00 heroku[run.4407]: State changed from starting to up
2015-06-17T23:39:56.754893+00:00 heroku[run.4407]: Process exited with status 1
2015-06-17T23:39:56.762444+00:00 heroku[run.4407]: State changed from up to complete
2015-06-17T23:40:47.681100+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by [email protected]
2015-06-17T23:40:53.651168+00:00 heroku[run.8024]: Starting process with command `bundle exec rake db:migrate`
2015-06-17T23:40:53.610009+00:00 heroku[run.8024]: Awaiting client
2015-06-17T23:40:53.798975+00:00 heroku[run.8024]: State changed from starting to up
2015-06-17T23:41:03.639977+00:00 heroku[run.8024]: State changed from up to complete
2015-06-17T23:41:03.626657+00:00 heroku[run.8024]: Process exited with status 0
2015-06-17T23:41:26.493897+00:00 heroku[api]: Starting process with command `rails console` by [email protected]
2015-06-17T23:41:30.348681+00:00 heroku[run.8888]: Awaiting client
2015-06-17T23:41:30.417375+00:00 heroku[run.8888]: Starting process with command `rails console`
2015-06-17T23:41:30.609619+00:00 heroku[run.8888]: State changed from starting to up
2015-06-17T23:42:01.623246+00:00 heroku[run.8888]: State changed from up to complete
2015-06-17T23:42:01.590101+00:00 heroku[run.8888]: Process exited with status 0
2015-06-17T23:42:11.021886+00:00 heroku[router]: at=info method=GET path="/" host=safe-dusk-1738.herokuapp.com request_id=464abcfc-3e80-4c32-ac10-52c4cf0816d1 fwd="65.101.157.210" dyno=web.1 connect=2ms service=12ms status=500 bytes=1754
2015-06-17T23:42:11.012701+00:00 app[web.1]: Started GET "/" for 65.101.157.210 at 2015-06-17 23:42:11 +0000
2015-06-17T23:42:11.017657+00:00 app[web.1]:   Rendered partials/_navbar.html.erb (0.8ms)
2015-06-17T23:42:11.015571+00:00 app[web.1]: Processing by UsersController#index as HTML
2015-06-17T23:42:11.017726+00:00 app[web.1]:   Rendered users/index.html.erb within layouts/application (1.0ms)
2015-06-17T23:42:11.017834+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2015-06-17T23:42:11.019330+00:00 app[web.1]:
2015-06-17T23:42:11.019332+00:00 app[web.1]: ActionView::Template::Error (undefined method `id' for nil:NilClass):
2015-06-17T23:42:11.019334+00:00 app[web.1]:     30:       </ul>
2015-06-17T23:42:11.019337+00:00 app[web.1]:     32:       <ul class="nav navbar-nav navbar-right">
2015-06-17T23:42:11.019335+00:00 app[web.1]:     31:       <!-- Right Side of Nav Bar -->
2015-06-17T23:42:11.019340+00:00 app[web.1]:     34:         <li class="dropdown">
2015-06-17T23:42:11.019338+00:00 app[web.1]:     33:         <li><a href="#">Welcome back, <%[email protected]%></a></li>
2015-06-17T23:42:11.019342+00:00 app[web.1]:     35:           <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Account<span class="caret"></span></a>
2015-06-17T23:42:11.019343+00:00 app[web.1]:     36:           <ul class="dropdown-menu" role="menu">
2015-06-17T23:42:11.019345+00:00 app[web.1]:   app/views/partials/_navbar.html.erb:33:in `_app_views_partials__navbar_html_erb__120412911408632626_69924047825640'
2015-06-17T23:42:11.019347+00:00 app[web.1]:   app/views/users/index.html.erb:54:in `_app_views_users_index_html_erb__1269627799293070153_69924047657220'
2015-06-17T23:42:11.019348+00:00 app[web.1]:
2015-06-17T23:42:11.019350+00:00 app[web.1]:
2015-06-17T23:42:12.001393+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=safe-dusk-1738.herokuapp.com request_id=d2aa6285-2b5a-4ac6-9a64-7fe476cdef8f fwd="65.101.157.210" dyno=web.1 connect=2ms service=4ms status=304 bytes=133

User Controller Code: Can't seem to figure out what is wrong this was all working before with no problems.

class UsersController < ApplicationController
  def index
    if flash[:errors]
      @errors = flash[:errors]
    end
    if flash[:success]
      @success = flash[:success]
    end
  end

  def show
    @user = User.find(params[:id])
  end

  def edit
    @user = User.find(params[:id])
  end

  def create
    @user = User.new(user_params)
    if @user.save
      flash[:success] = "User successfully created!"
      session[:user_id] = @user.id
      redirect_to '/mains'
    else
      flash[:errors] = @user.errors.full_messages
      redirect_to '/users'
    end
  end

  private
    def user_params
      params.require(:user).permit(:name, :email, :password,       :password_confirmation)
    end
end

Upvotes: 0

Views: 48

Answers (1)

Mike Manfrin
Mike Manfrin

Reputation: 2762

The issue isn't to do with Heroku.

In your view code, you are referencing @user.id -- the error being returned ("ActionView::Template::Error (undefined method 'id' for nil:NilClass)") means that you are calling :id on nil -- which means @user is nil.

Check your controller code for where you are assigning @user and try to see why it might be empty. If you can't figure it out, edit your post to show the controller code.

Upvotes: 2

Related Questions