2
我有一個真正的狡猾問題。這裏是我的模型:命名範圍不與時區合作?
class Entry < ActiveRecord::Base
default_scope :order => 'published_at DESC'
named_scope :published, :conditions => ["published_at < ?", Time.zone.now], :order => 'published_at DESC'
belongs_to :blog
end
現在,如果我做
@entries = Entry.published.paginate_by_blog_id @blog.id,
:page => params[:page],
:order => 'published_at DESC',
除非我published_at移動慢一小時不退還的帖子。但是:
@entries = Entry.paginate_by_blog_id @blog.id,
:page => params[:page],
:conditions => ["published_at < ?", Time.zone.now],
:order => 'published_at DESC',
它工作正常!
我要瘋了這裏,任何人有地方甚至開始調試任何想法?
謝謝,這解決了它。我會馬上閱讀這個話題! – 2009-11-16 15:51:05