Rails - do you know when your code runs?
I didn’t knew that stuff like 1.week.ago is evaluated only when class is loaded, so after a week the statement:
has_many :recent_posts, :class_name => ‘Post’, :conditions => [“created_at > ?”, 1.week.ago]
would return last two weeks of posts (provided that app hasn’t been restarted).
3 years ago • 0 notes