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 6923771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:34:43+00:00 2026-05-27T10:34:43+00:00

I am using paperclip to upload user avatar.Evrery thing work well but when i

  • 0

I am using paperclip to upload user avatar.Evrery thing work well but when i hit the save button i got the error :

    ActiveRecord::AssociationTypeMismatch in UsersController#update

    Usernote(#79841148) expected, got Array(#25890648)

    Request

Parameters:

{"authenticity_token"=>"bLhGiceEIEohpuuclDpbmpzJR7SFb4HEY4+Qy9ER20E=",
 "_method"=>"put",
 "utf8"=>"✓",
 "id"=>"2",
 "user"=>{"user_information"=>{"passport_number"=>"",
 "passport_expiry_date"=>"",
 "gender"=>"Male",
 "birth_date"=>"",
 "marriage_date"=>"",
 "present_address"=>"",
 "blood_group"=>"",
 "emergency_contact"=>"",
 "marital_status"=>"Married"},
 "usernotes"=>{"notes"=>"Hi this is First note from Ritz"},
 "designation_id"=>"2",
 "username"=>"ritz",
 "reporting_to_id"=>"",
 "avatar"=>#<ActionDispatch::Http::UploadedFile:0x9514578 @headers="Content-Disposition: form-data; name=\"user[avatar]\"; filename=\"child ravi.jpg\"\r\nContent-Type: image/jpeg\r\n",
 @content_type="image/jpeg",
 @original_filename="child ravi.jpg",
 @tempfile=#<File:C:/Users/user/AppData/Local/Temp/RackMultipart20111207-2300-3nkxr9-0>>,
 "last_name"=>"roshan",
 "user_salary_detail"=>{"work_phone"=>"",
 "EPS_account_number"=>"",
 "work_type"=>"Permanent",
 "date_of_joining"=>"",
 "work_location"=>"",
 "branch"=>"",
 "PF_account_number"=>"",
 "bank_name"=>"",
 "PAN"=>"",
 "status"=>"Active",
 "bank_account_number"=>""},
 "password"=>"[FILTERED]",
 "department_id"=>"1",
 "first_name"=>"hritwik",
 "email"=>"rvdthakur@yahoo.com"}}

Here is My Model:

class User < ActiveRecord::Base
   has_attached_file :avatar,
                    :styles => {
                      :thumb => "75x75#",
                      :small => "100x100#",
                      :medium => "150x150>"
                    },
                    :default => :thumb,
                    :url => "/users/user_avatar/:attachment/:id/:style/:basename.:extension",  
                    :path => ":profitnext/public/images/users/user_avatar/:attachment/:id/:style/:basename.:extension"  

# avatar validations
  validates_attachment_size :avatar, :less_than => 5.megabytes
  validates_attachment_content_type :avatar, :content_type => ['image/jpeg', 'image/png'] 
end

and My View:

<%= image_tag @user.avatar.url %>
              <%= image_tag @user.avatar.url(:thumb) %>

I got that error after hitting save button.I am struggling with this a lot.Thanks in advance.

  • 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-05-27T10:34:44+00:00Added an answer on May 27, 2026 at 10:34 am

    My guess is that this is nothing to do with paperclip but is more along the lines of this. Do you have a has_many :usernotes in your User model and/or a belongs_to :user in your Usernote model?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using paperclip to upload an image and an audio file but I
I'm using paperclip to upload some attachments to my application. This works fine, but
I'm using paperclip to upload images to the site but when I do, it
I'm using paperclip to allow user to upload images and I want to convert
I am using Paperclip to, among other things, allow a registered user to upload
here was my situation. I was using paperclip to let user upload images. It
I'm using paperclip to upload a pdf. Once the file is uploaded I need
I'm trying to upload an MP3 file (using the paperclip plugin) and then read
Hi i want to upload mulitiple file using rails 3 and paperclip please help
I've been using paperclip to upload and auto-resize photos in my Rails app, and

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.