Hi,

Check out this excelent railscast:

http://railscasts.com/episodes/129-custom-daemon

It is really easy & effective.

Also, Thorny Gorms has some built-in checks for form expiration:

http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/9ec5a5112548c95e

Cheers, Sazima

On Feb 12, 4:35 pm, Gavin <[email protected]> wrote:
> Am I right in saying Daemons for frequent tasks (performing a specific
> check every minute or so) and cron jobs for less regular tasks
> (cleaning up sessions every week or so)?
>
> Are Daemons resource-intensive?
>
> On 12 Feb, 18:27, Chris Kottom <[email protected]> wrote:
>
> > +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 <[email protected]> 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 
> > > <[email protected]<https://mail.google.com/mail?view=cm&tf=0&[email protected]>
>
> > > 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 
> > > > > <[email protected]<https://mail.google.com/mail?view=cm&tf=0&[email protected]>
>
> > > > 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 [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