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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:18:12+00:00 2026-06-17T00:18:12+00:00

I have a problem with my avatar upload. It worked once for me but

  • 0

I have a problem with my avatar upload. It worked once for me but I must be blind this time.
I am using paperclip and aws-sdk gem and set up everything as described here.

I have tested it with 2 buckets. One with the standard us-location and one with the eu-west-1 location. Neither is working.

Here is all my related code:

config/s3.yml

development:
  bucket: ***
  access_key_id: ***  
  secret_access_key: ***
test:
  bucket: ***
  access_key_id: ***  
  secret_access_key: ***
production:
  bucket: ***
  access_key_id: ***  
  secret_access_key: ***

app/model/art.rb

class Art < ActiveRecord::Base
  attr_accessible :created_at, :description, :name, :avatar
  has_attached_file :avatar,
      :storage => :s3,
      :s3_credentials => "#{Rails.root}/config/s3.yml",
      :url => ':set_alias_url',
      :path => "/:style/:id/:filename.:extension",
          :bucket => '***'

end

app/controller/arts_controller.rb

class ArtsController < ApplicationController 
...
def create
      @art = Art.new(params[:art])
      if @art.save
          flash[:notice] = "sucessfully saved upload" 
          redirect_to arts_path
      else 
          flash[:notice] = "error" 
          render "new"
      end

    ...

app/views/arts/new.html.erb

<h1>Arts#new</h1>
<p>Find me in app/views/arts/new.html.erb</p>
<%= form_for(@art, :url => arts_path, :html => { :multipart => true }) do |f| %>
    <%= f.label :name %> <br/>
    <%= f.text_field :name %> <br/>

    <%= f.label :description %> <br/>
    <%= f.text_field :description %> <br/>

    <%= f.label :avatar %> <br/>
    <%= f.file_field :avatar %> <br/>
    <%= f.submit %>
<% end %>

I searched the web for 2 days now but I cannot find my error. Here is the response from the server:

POST "/arts/new" for 127.0.0.1 at 2012-12-19 12:11:39 +0100
    Processing by ArtsController#new as HTML
      Parameters: {"utf8"=>"✓", "authenticity_token"=>"ZyZFfSaTl9CQpL5kOXyt/rcoi+SCuNp5/deCYda83sE=", "art"=>{"name"=>"asdf", 
"description"=>"asdf", 
"avatar"=>#<ActionDispatch::Http::UploadedFile:0x0000000296e0b8 @original_filename="lakritz10.jpg", 
@content_type="image/jpeg", 
@headers="Content-Disposition: form-data; name=\"art[avatar]\"; filename=\"lakritz10.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20121219-5804-1rnvkmj>>}, 
"commit"=>"Create Art

So can anyone help me to fix this?

thanks in advance.

EDIT: It seems like even without an attachment that nothing is getting saved in the database. Thats wired…

EDIT_SOLUTION: In order to solve my particular problem I had to change the routes.rb
I previously assumed that the entry

match "arts/new", :to => "arts#new", :as => 'arts'

would do the job. This was not the case.
I had to change the line into:

resources :arts

Because i do not understand how routes exactly work yet, I cannot explain it.

  • 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-17T00:18:13+00:00Added an answer on June 17, 2026 at 12:18 am

    Your line:

    match "arts/new", :to => "arts#new", :as => 'arts'
    

    only creates a route to the new action. It maps arts_path to arts/new which is then the target of your form. You really need to submit the form to arts#create which is what the resource does automatically for a POST with a new object.

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

Sidebar

Related Questions

Once again I have a small problem to get this done in django. But
I have a problem using the paperclip with sinatra and mongoid. When I upload
I have problem with my query on C, I’m using the oci8 driver. This
I have an avatar upload which works fine, the problem is that when the
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have a problem when viewing this site with the latest Chrome for Android
I have using jsf2.0 in eclipse ide.I have a problem to store a image
My problem is, i have a table User and Table Group (this table use
In my PHP codes, I always have this problem that I can not use
I have been trying to implement a image upload for changing avatar for individual

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.