On 20 June 2011 09:15, John Feminella <[email protected]> wrote:
>> def expired?
>>  Time.now - self.created_at > 10.days     # or whatever the period is
>> end
>
> fwiw, I prefer to write that sort of condition as:
>
> =====
> def expired?
>  self.created_at < 10.days.ago
> end
> =====

Yes, much better, I had forgotten about ago.

Colin

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to