Ruby on Rails Monday, October 29, 2012

Hi Pierre,

On Mon, Oct 29, 2012 at 11:23 AM, PierreW <wamrewam@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.

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).

Bill: we run this service completely independently, on a different
box. So it does not have access to the app.

Maybe we should not be doing something like this?


If the methods don't need access to the DB, then the question is do they need access to the AR object?  Or are they being passed the data they need to work on as arguments?  If the latter, then they're more 'helpers' and could be re-factored out into a module to be included in the model and, independently, in the service.  If that doesn't sound feasible, post some code so we can see better what you're doing.

Best regards,
Bill

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment