Heroku Rails Internal Server Error
I got a 500 Internal Sever error when I try to deploy my rails app on heroku. It works fine on my local machine, so i'm not sure what's wrong here. Seems to be something with the "sessions" on the home controller. Here is my log:
==> production.log <==
# Logfile created on Sun May 09 17:35:59 -0700 2010
Processing HomeController#index (for 76.169.212.8 at 2010-05-09 17:36:00) [GET]
ActiveRecord::StatementInvalid (PGError: ERROR: relation "sessions" does not ex
ist
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a
.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"sessions"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
):
lib/authenticated_system.rb:106:in开发者_运维百科 `login_from_session'
lib/authenticated_system.rb:12:in `current_user'
lib/authenticated_system.rb:6:in `logged_in?'
lib/authenticated_system.rb:35:in `authorized?'
lib/authenticated_system.rb:53:in `login_required'
/home/heroku_rack/lib/static_assets.rb:9:in `call'
/home/heroku_rack/lib/last_access.rb:25:in `call'
/home/heroku_rack/lib/date_header.rb:14:in `call'
thin (1.2.7) lib/thin/connection.rb:76:in `pre_process'
thin (1.2.7) lib/thin/connection.rb:74:in `catch'
thin (1.2.7) lib/thin/connection.rb:74:in `pre_process'
thin (1.2.7) lib/thin/connection.rb:57:in `process'
thin (1.2.7) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.2.7) lib/thin/backends/base.rb:57:in `start'
thin (1.2.7) lib/thin/server.rb:156:in `start'
thin (1.2.7) lib/thin/controllers/controller.rb:80:in `start'
thin (1.2.7) lib/thin/runner.rb:177:in `send'
thin (1.2.7) lib/thin/runner.rb:177:in `run_command'
thin (1.2.7) lib/thin/runner.rb:143:in `run!'
thin (1.2.7) bin/thin:6
/usr/local/bin/thin:20:in `load'
/usr/local/bin/thin:20
Rendering /disk1/home/slugs/155328_f2d3c00_845e/mnt/public/500.html (500 Interna
l Server Error)
And here is my home_controller.rb
class HomeController < ApplicationController
before_filter :login_required
def index
@user = current_user
@user.profile ||= Profile.new
@profile = @user.profile
end
end
Does it have something the way my routes are set up? Or is it my authentication? (I am using restful authentication with Bort)
Your app seems to be looking for a sessions table.
Have you run all of your migrations?
Sometimes it can help to use heroku db:push to ensure that your database is the same locally and remote.
Sounds like you forgot to heroku rake db:migrate
Also, heroku rake db:sessions:create
. Create your sessions table.
Migrate too.
heroku rake db:migrate
Cheers! :)
精彩评论