Thanks a lot guys for pointing me in the right direction. I ended up extracting the methods I needed from the models. It is much cleaner.
Thanks! PJ On Oct 29, 5:19 pm, Colin Law <clan...@googlemail.com> wrote: > On 29 October 2012 16:23, PierreW <wamre...@googlemail.com> wrote: > > > Hi Colin, Bill > > > Here is what we are doing: > > > - we pass to our "service" the Model objects (we Marshal.dump them in > > the main app, enqueue them, and the service Marshal.load them) instead > > of their unique ID. > > - in the service, we just need to access some of the models' methods. > > We know these methods don't need a DB connection. > > Do you need knowledge of any of the attributes of the object that are > database fields? If so then you need a connection to the db as it is > by looking in the db that the model knows what its fields are and > hence the attribute names. > > > > > The reason we have it setup like this is initially, we were running > > these tasks in threads within a background job (threads caused a bunch > > of issues when we were using the DB, so we made sure what we passed to > > the threads would never use the DB). > > As Bill has suggested in his reply, you could extract the methods that > do not need the database (if they really do not) out into helpers. > > 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.