好吧,通过Postgresql和SQLite之间的差异来解决最后一个问题,好像Heroku告诉我我有另一个问题。我对Ruby和Rails很陌生,所以我开始无法解读这些东西。在这里寻找一个小方向。错误消息和PostsController索引如下。我检查了我的routes.rb文件,并且在那里似乎都很好,但我可能会错过一些东西。如果您需要,我会发布。Heroku推问题第2部分 - Postgresql - PGError关系不存在 - Ruby on Rails
Processing PostsController#index (for 99.7.50.140 at 2010-04-23 15:19:22) [GET]
ActiveRecord::StatementInvalid (PGError: ERROR: relation "tags" does not exist
: 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 = '"tags"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
):
PostsController#指数
def index
@tag_counts = Tag.count(:group => :tag_name,
:order => 'count_all DESC', :limit => 20)
conditions, joins = {}, :votes
@ugtag_counts = Ugtag.count(:group => :ugctag_name,
:order => 'count_all DESC', :limit => 20)
conditions, joins = {}, :votes
@vote_counts = Vote.count(:group => :post_title,
:order => 'count_all DESC', :limit => 20)
conditions, joins = {}, :votes
unless(params[:tag_name] || "").empty?
conditions = ["tags.tag_name = ? ", params[:tag_name]]
joins = [:tags, :votes]
end
@posts=Post.paginate(
:select => "posts.*, count(*) as vote_total",
:joins => joins,
:conditions=> conditions,
:group => "votes.post_id, posts.id ",
:order => "created_at DESC",
:page => params[:page], :per_page => 5)
@popular_posts=Post.paginate(
:select => "posts.*, count(*) as vote_total",
:joins => joins,
:conditions=> conditions,
:group => "votes.post_id, posts.id",
:order => "vote_total DESC",
:page => params[:page], :per_page => 3)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
format.json { render :json => @posts }
format.atom
end
end
你试过“heroku rake db:migrate”吗? – 2010-08-13 13:25:53
@Comptrol“heroku rake db:migrate”为我做了诡计。 Cmd行输出表示该cmd已被弃用,而应该使用“heroku run rake”。那么这是否意味着每次我通过运行“git push heroku master”后的迁移在本地进行db更改时,我都必须跟进一个“heroku run rake”? – 2013-03-25 18:51:52