+1 for implementing this as a cron job.  Sometimes the cleanest solution is
outside the framework.

On Thu, Feb 12, 2009 at 4:20 PM, Gavin <ga...@thinkersplayground.com> wrote:

>
> Writing more unit tests for this as we speak
>
> Thanks for the tip Robert
>
> PS - I presume, if I were to use constants that I would define the
> constants in the class itself?
>
> On 12 Feb, 15:17, Robert Walker 
> <rails-mailing-l...@andreas-s.net<https://mail.google.com/mail?view=cm&tf=0&to=rails-mailing-l...@andreas-s.net>
> >
> wrote:
> > Gavin wrote:
> > > So, would it be more appropriate to write a method like
> >
> > > def purchased?
> > >   if self.status > 3
> > >     return true
> > >   else
> > >     return false
> > >   end
> > > end
> >
> > > and then call the purchased? method to perform the check?
> >
> > > On 12 Feb, 14:39, Robert Walker 
> > > <rails-mailing-l...@andreas-s.net<https://mail.google.com/mail?view=cm&tf=0&to=rails-mailing-l...@andreas-s.net>
> >
> >
> > Actually it could be as simple as adding some constants to represent
> > your states.
> >
> > Example:
> > STARTED = 1
> > PROCESSING = 2
> > COMPLETED = 3
> > BILLED = 4
> > PAID = 5
> >
> > if self.state > COMPLETED
> >
> > You just want to avoid the use of a "magic number" by giving it clear
> > meaning.
> >
> > --
> > Posted viahttp://www.ruby-forum.com/.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to