当我尝试在heroku上部署rails应用程序时出现500内部服务器错误。它在我的本地机器上工作正常,所以我不确定这里有什么问题。似乎是家庭控制器上的“会话”。这是我的日志:
==> 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)
这是我的home_controller.rb
class HomeController < ApplicationController
before_filter :login_required
def index
@user = current_user
@user.profile ||= Profile.new
@profile = @user.profile
end
end
我的路线设置方式有什么用吗?或者是我的身份验证? (我正在使用Bort的Restful身份验证)
答案 0 :(得分:8)
您的应用似乎正在寻找会话表。
您是否运行了所有迁移?
有时使用 heroku db:push 可以帮助确保您的数据库本地和远程相同。
答案 1 :(得分:2)
听起来你忘了heroku rake db:migrate
答案 2 :(得分:1)
另外,heroku rake db:sessions:create
。创建会话表。
迁移。
heroku rake db:migrate
干杯! :)