Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9276837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:56:53+00:00 2026-06-18T16:56:53+00:00

I have a users object which I get user data from twitter/facebook, then hit

  • 0

I have a users object which I get user data from twitter/facebook, then hit save and finally send the user_id and the avatar_url to Resque.enqueue.

self.save!

Resque.enqueue(AvatarPull, {user_id: self.id, url: user[:avatar] }) if user[:avatar] and self.avatar.blank?

Then in self.perform I just use find to get user by id then set the avatar then save.

@queue = :paperclip

def self.perform(options={})

    user = User.find(options[:user_id])
    user.avatar = URI.parse(options[:url].sub("_normal", ""))
    user.save!
end

The problem is I get this error for not finding user by id

(Job{paperclip} | AvatarPull | [{"user_id"=>"51191a5e0eae9cfccf000006", "url"=>"http://source"}]) failed: #<Mongoid::Errors::InvalidFind: 

Problem:
Calling Document.find with nil is invalid.

Summary:
Document.find expects the parameters to be 1 or more ids, and will return a single document if 1 id is provided, otherwise an array of documents if multiple ids are provided.

Resolution:
Most likely this is caused by passing parameters directly through to the find, and the parameter either is not present or the key from which it is accessed is incorrect.>

I think it is because the time taken to go to the queue is less than the time it takes to save the record in the database. Is there away to fix this problem, maybe add delay or is there something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:56:55+00:00Added an answer on June 18, 2026 at 4:56 pm

    Resque jobs are stored as JSON packages. What this means is that the options hash that gets passed to the perform method now has keys that are strings and not symbols. Notice the quotes around the “user_id” in the error. Using the string representation of the keys should work:

    user = User.find(options["user_id"])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an object which holds a user name and job count, which then
I have an user object for my restful service, which has an userid and
I have a script which creates a user-defined object like this: obj = new
I have an object called users that I use to store user objects that
I'm trying to add an object created from Entity Data Model classes. I have
I have a user object represented in JPA which has specific sub-types. Eg, think
i am writing java desktop application. i have some textareas to get data from
I have created an application which inserts data into a SQL database. Basically, from
I have a JPA/Hibernate object which uses a composite key as the primary key.
I have some code, which uses the ExecuteStmt method on the Axapta Object when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.