[Backgroundrb-devel] Very strange after_save problem. Please help.
bjohnson at contuitive.com
Mon Jul 17 18:49:44 EDT 2006
I have a very strange problem here. I do not get this. So any help is
Basically I have a model that calls a method in the background
process in the "after_save" method. Let's call the model products. So
what happens is this:
1. I create a new product.
2. Everything works and the product is saved with id 13.
3. A method is called in my background process passing it the NEW
product id in the after_save method.
4. That method in the background process says "Can't find Product
5. An exception is then passed back to my after_save method and the
product rolls back like adding it never happened. Because when an
exception is raised in after_save it rolls back.
So I figured maybe it wasn't connecting to the database or something.
I adding a product in the db manually and added the following in my
p = Product.find_all
I try to add another product and it shows me that product I just
added into the database manually but not the one that was just
created through the product model. So the backgrond process is
connecting to the database.
So in my after_save method i did the following to make sure it was
getting into the database:
p = Product.find id
I tried to add a product again and it raised an exception with the
product information that I JUST added.
Why is backgroundrb not seeing new additions to the database when
being called from after_save? It's like backgroundrb doesn't
acknowledge it's existence until after_save is finished.
Anyways, if this is the case, is there a work around so that I can
invoke a backgroundrb method on a freshly saved product?
Thanks a lot for your help.
E: bjohnson at contuitive.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Backgroundrb-devel