[Backgroundrb-devel] Inconsistent Model creation behavior

hemant gethemant at gmail.com
Thu Jan 17 04:30:17 EST 2008


Hi

On Jan 17, 2008 2:16 PM, Benjamin H. Bryant <iambenbryant at gmail.com> wrote:
> Hi,
>
> I have a relatively simple Worker: (I added the line numbers to the
> email, they are not in the worker)
>
> #####################################################################################
>
> class ImagetestWorker < BackgrounDRb::MetaWorker
>
>    set_worker_name :imagetest_worker
>    def create(args = nil)
>
>    end
>
>    def save_image(args)
>
>      @newbook = Book.new
>      @newbook.comment = "hello"
>      @newbook.save
>
>   14   @newerimage = Image.new
>   15   @newerimage.user_id = args[:user_id]
>   16   @newerimage.uploaded_data = args[:temppath]
>          @newerimage.save
>
>    end
>
> end
>
> #####################################################################################
>
> It will create and save the Book object without problems.  However, it
> will not create the Image object and instead I receive this error:
>
> #####################################################################################
>
> workers/imagetest_worker.rb:15:in `save_image': You have a nil object
> when you didn't expect it! (NoMethodError)
> You might have expected an instance of ActiveRecord::Base.
> The error occurred while evaluating nil.[]      from /Users/BBryant/Sites/
> date_site/trunk/vendor/plugins/backgroundrb/server/meta_worker.rb:
> 223:in `send'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> server/meta_worker.rb:223:in `process_request'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> server/meta_worker.rb:207:in `receive_data'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> framework/worker.rb:54:in `receive_internal_data'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/BackgrounDRB/
> lib/../framework/bin_parser.rb:29:in `call'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/BackgrounDRB/
> lib/../framework/bin_parser.rb:29:in `extract'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> framework/worker.rb:52:in `receive_internal_data'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> framework/worker.rb:48:in `handle_internal_messages'
>          ... 10 levels...
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> framework/packet_master.rb:19:in `run'
>         from /Users/BBryant/Sites/date_site/trunk/vendor/plugins/backgroundrb/
> server/master_worker.rb:163:in `initialize'
>         from script/backgroundrb:41:in `new'
>         from script/backgroundrb:41
>
> ####################################################################################
>

Ok so you are invoking this task from rails right? Can you show us the
code thats being used to invoke above mentioned task?

-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org


More information about the Backgroundrb-devel mailing list