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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:17:00+00:00 2026-06-05T20:17:00+00:00

In my rails 3.2.1 app Im getting this error in my browser, when Im

  • 0

In my rails 3.2.1 app Im getting this error in my browser, when Im trying to upload a file from my machine.

NoMethodError in AssetsController#create

undefined method `symbolize_keys' for #<String:0x00000104200ad0>
app/controllers/assets_controller.rb:53:in `block in create'
app/controllers/assets_controller.rb:52:in `create

This is the out put on the rails thin server running on my development machine:

Rendered assets/new.html.erb within layouts/application (5.8ms)
Completed 200 OK in 104ms (Views: 101.2ms | ActiveRecord: 0.5ms)


Started POST "/assets" for 127.0.0.1 at 2012-06-17 16:18:03 -0700
Served asset  - 404 Not Found (7ms)
Processing by AssetsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"XXXX=", "asset"=>{"user_id"=>"1",   "uploaded_file"=>#<ActionDispatch::Http::UploadedFile:0x0000010430e080 @original_filename="41382-450x-e_37.jpeg", @content_type="image/jpeg", @headers="Content- Disposition: form-data; name=\"asset[uploaded_file]\"; filename=\"41382-450x-e_37.jpeg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/P+/P+AVMPNFEyO8F-xz7UfIP++++TI/-Tmp-/RackMultipart20120617-19438-1y1fya5>>}, "commit"=>"Create Asset"}

User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
 (0.2ms)  BEGIN
SQL (0.5ms)  INSERT INTO "assets" ("created_at", "updated_at",     "uploaded_file_content_type", "uploaded_file_file_name", "uploaded_file_file_size",   "uploaded_file_updated_at", "user_id") 
VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id"    [["created_at", Sun, 17 Jun 2012  23:18:03 UTC +00:00], 

["updated_at", Sun, 17 Jun 2012  23:18:03 UTC +00:00], ["uploaded_file_content_type",   "image/jpeg"], ["uploaded_file_file_name", "41382-450x-e_37.jpeg"],     

["uploaded_file_file_size", 36549], ["uploaded_file_updated_at", Sun, 17 Jun 2012  23:18:03 UTC +00:00], ["user_id", 1]]
[paperclip] Saving attachments.
[paperclip] saving assets/23/41382-450x-e_37.jpeg
 (0.1ms)  ROLLBACK

Completed 500 Internal Server Error in 7ms

NoMethodError (undefined method `symbolize_keys' for #<String:0x00000104200ad0>):
app/controllers/assets_controller.rb:53:in `block in create'
app/controllers/assets_controller.rb:52:in `create'

This is what my create method in Assets controller looks like:

# POST /assets
# POST /assets.json
def create
 @asset = current_user.assets.new(params[:asset])

 respond_to do |format|
   if @asset.save
     format.html { redirect_to @asset, notice: 'Asset was successfully created.' }
     format.json { render json: @asset, status: :created, location: @asset }
   else
     format.html { render action: "new" }
     format.json { render json: @asset.errors, status: :unprocessable_entity }
   end
 end

end

Any idea what might be happening? Would really appreciate some feedback.

Thanks


EDIT:
Im using the AWS gem to upload the file to amazon s3 as per this tutorial.
I have this config file in my app at config/s3_credentials.yml which contains my amazon s3 credentials.

Im using this code in my asset.rb file:

 has_attached_file :uploaded_file,
                :path => "assets/:id/:basename.:extension",
                :storage => :s3,
                :s3_credentials => "#{Rails.root}/config/s3_credentials.yml",
                :bucket => "XXXX"

this is my _form thats called by the view:

<%= simple_form_for @asset, :html=> { :multipart => true}  do |f| %>
  <%= f.error_notification %>

  <div class="form-inputs">
  <%= f.label :UserID %>
  <%= f.input :user_id %>
 </div>
 <div class="form-inputs">
<%= f.label :uploaded_file, "File" %>
    <%= f.file_field :uploaded_file %>
 </div>
<div class="form-actions">
 <%= f.button :submit %>
</div>
<% end %>

s3_credential.yml file

development:
  access_key_id:"XXXXXXXXXX"
  secret_access_key:"XXXXXXXXXXXXXXXXXXXX"

production:
  access_key_id:"XXXXXXXXXX"
  secret_access_key:"lG/XXXXXXXXXXXXXXXXXXXX"
  • 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-05T20:17:02+00:00Added an answer on June 5, 2026 at 8:17 pm

    It sounds like you are trying to create @asset from a String that you passed to the controller. Rails is expecting hashwithindifferentaccess, and then calls symbolize_keys.

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

Sidebar

Related Questions

I'm trying to upload a rails app to dotcloud. I'm getting this error: PG::Error
I am getting this error in rails whenever i am trying to create an
I'm trying to create a rails app, but somethings going wrong, I'm getting a
I have a rails application and i keep getting this error /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte
I kept getting this error in my Rails app after upgrading to Rails 3.
So I'm getting this error in my rails app: No route matches {:action=>edit, :controller=>parties}
I'm getting the following error in my rails app: comparison of User with User
When I run rails new app...I get this error /Library/Ruby/Site/1.8/rubygems/specification.rb:542:in `read': Permission denied -
I'm a newbie Rails developer who is getting the following error when trying to
I am running Rails 3.1.1 and getting this error when running this command. Obviously

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.