2011-03-30 70 views
0

所以我在本地有查詢有什麼問題?

@fooentries = Entry.where(:status => 'foo').where("created_at >= #{Date.today}") 

,哪個跑得很好,但是當我部署到Heroku的它似乎是打破它。

我問一個朋友,他告訴我做以下,但這本地失敗:

@fooentries = Entry.where(:status => 'foo').where("created_at >= #{Time.zone.now.beginning_of_day.to_s(:db)}") 

有人嗎?

編輯:無所謂,修復它。這是查詢需要是─

@fooentries = Entry.where(:status => 'foo').where('entries.created_at >= ?', Time.zone.now.beginning_of_day) 
+3

您收到了哪些錯誤消息? – William 2011-03-30 20:13:48

回答

0

按照上述修改的內容,這正是我需要的 -

@fooentries = Entry.where(:status => 'foo').where('entries.created_at >= ?', Time.zone.now.beginning_of_day) 
1

你試圖逃跑的查詢,也許這取決於你的格式查詢內置 嘗試

@fooentries = Entry.where(:status => 'foo').where("created_at >= ?", Date.today)