Thanks for that, I simplified things a bit for the post.  There is
actually a reason to have an explicit status.

I'm going ahead with adding the after_find callback but I think I've
run into another issue.

I was thinking I would do the following in after_find when I detected
an expired message.

Change its status to expired.
Save It
Return false.

I was thinking returning false would result in the find not returning
that result.  But it still seems to be returning it.  I couldn't find
anything online that really explained what is supposed to happen when
you return false in this callback.  Any ideas?

On Jun 20, 6:53 am, Colin Law <[email protected]> wrote:
> 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