Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Mongoid 3.0.x Fix #53

Closed
wants to merge 1 commit into from

5 participants

@noiseunion

When tasks were being placed in the queue system, the "id" property of the model was sending an ObjectId object to the queue system instead of a simple string version of the model id. I changed the code to call "to_s" on the ID property and ensure that only simple values are being sent to the queue.

Tested with Mongoid 3.0.1 & Resque 1.21.0

@noiseunion noiseunion Fix to support Mongoid 3.0.x
An error was occurring due to the object id not being converted to a string when scheduling.  Added a "to_s" call to make sure that the id is in fact a string when scheduling the delayed task.

Signed-off-by: JD Hendrickson <jd@digitalopera.com>
8b9e48e
@vtabary vtabary referenced this pull request from a commit in vtabary/carrierwave_backgrounder
@vtabary vtabary Additionnaly to issue and pull request #53, change the second functio…
…n : store_in_background
133ba20
@nvdk

I can confirm this fix works

@foohey

Hey guys. (sorry, not the right place, but seems you are using carrierwave_backgrounder successfully with mongoid)

I'm running issues to setup carrierwave_backgrounder with mongoid & sidekiq.

After re-reading doc many times, I can't get it working. Nothing happen, no errors, no queue in sidekiq (have devise work great with sidekiq).

If someone can take a look on this gist: https://gist.github.com/e12a64598ac507683ff2 , maybe I have forget something...

BTW: tried with @vtabary & @noiseunion repos.

thanks in advance

@noiseunion

unfortunately I've not used Sidekiq yet (although it looks interesting). So I don't know that I can really help out much. I know that I can offer much help.

@noiseunion

have you tried using the Master branch?

@foohey

yes, every repos doesn't work.

I just forked and to add some loggers to try debug what's wrong

@foohey

When a bug... is not a bug...

# If you need to process/store the upload immediately:
@user.process_<column>_upload = true

Even without it, the first time, uploads were not processed... So in my understand, "activate this option to process your upload"

I just removed it, and now everything work... I really don't know what happen... Surely need some sleep

@lardawge
Owner

There has been some updates since this commit, can you fix so I can merge and release an update?

@vtabary vtabary referenced this pull request from a commit in vtabary/carrierwave_backgrounder
@vtabary vtabary Merge branch 'master' of https://github.com/lardawge/carrierwave_back…
…grounder as asked in #53
4d81537
@vtabary

I did a merge with the HEAD.

@lardawge lardawge closed this in f4bed7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 20, 2012
  1. @noiseunion

    Fix to support Mongoid 3.0.x

    noiseunion authored
    An error was occurring due to the object id not being converted to a string when scheduling.  Added a "to_s" call to make sure that the id is in fact a string when scheduling the delayed task.
    
    Signed-off-by: JD Hendrickson <jd@digitalopera.com>
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/backgrounder/orm/base.rb
View
8 lib/backgrounder/orm/base.rb
@@ -51,13 +51,13 @@ def set_#{column}_processing
def enqueue_#{column}_background_job
if defined? ::GirlFriday
- CARRIERWAVE_QUEUE << { :worker => #{worker}.new(self.class.name, id, #{column}.mounted_as) }
+ CARRIERWAVE_QUEUE << { :worker => #{worker}.new(self.class.name, id.to_s, #{column}.mounted_as) }
elsif defined? ::Delayed::Job
- ::Delayed::Job.enqueue #{worker}.new(self.class.name, id, #{column}.mounted_as)
+ ::Delayed::Job.enqueue #{worker}.new(self.class.name, id.to_s, #{column}.mounted_as)
elsif defined? ::Resque
- ::Resque.enqueue #{worker}, self.class.name, id, #{column}.mounted_as
+ ::Resque.enqueue #{worker}, self.class.name, id.to_s, #{column}.mounted_as
elsif defined? ::Qu
- ::Qu.enqueue #{worker}, self.class.name, id, #{column}.mounted_as
+ ::Qu.enqueue #{worker}, self.class.name, id.to_s, #{column}.mounted_as
end
end
Something went wrong with that request. Please try again.