好吧,通過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