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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:12:48+00:00 2026-06-13T23:12:48+00:00

I am using Rails 3.2 + Heroku + S3 + Paperclip to store an

  • 0

I am using Rails 3.2 + Heroku + S3 + Paperclip to store an icon on my User model. The model is not saving the 4 icon fields though. The images are getting processed and saved on S3 correctly and no errors are occurring. I also have another model that has a document being stored via Paperclip and S3. That model works perfectly in all cases. The User icon works locally but not on Heroku.

production.rb relevant configuration

config.paperclip_defaults = {
  :storage => :s3,
  :s3_credentials => {
    :bucket => ENV['AWS_BUCKET'],
    :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
    :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
  }
}

User model code:

class User < ActiveRecord::Base
  attr_accessible :icon

  has_attached_file :icon, :url => "/system/:rails_env/:attachment/:style/:hash.:extension",
    :hash_data => ":class/:attachment/:id",
    :hash_secret => "superSecretThing",
    :styles => { :medium => "300x300>", :thumb => "100x100>" },
    :default_url => "/blank.png"
  ...

Controller code: (This code is kind of crazy because I am AJAXing files Base64 encoded.)

  params[:user][:icon_data]
  decoded_file = Base64.decode64(data)
  begin
    split_name = params[:user][:icon_file_name].split(".")
    file = Tempfile.new([split_name[0..-2].join("."), ".#{split_name[-1]}"])
    file.binmode
    file.write(decoded_file)
    file.close
    @user.icon = open(file)
    @user.icon_file_name = params[:user][:icon_file_name]
  ensure
    file.unlink
  end
  @user.save

I do an almost identical process on another model with a Paperclip attachment and it works flawlessly. In both cases the attachment is being saved correctly to S3 and no errors are being raised. This gist has example output for a controller action from the Heroku logs.

I am pretty baffled because the other model works fine. The only real difference is that the User attachment does image processing but that part appears to be working fine.

The problem is the same as this one, but the solution there does not apply.

Thoughts?

  • 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-13T23:12:48+00:00Added an answer on June 13, 2026 at 11:12 pm

    So the problem is that not including the :path argument makes it try to use the :url parameter for both the url and the path. The real fix is to include the :path parameter in addition to the url.

    So for example a fixed configuration that works both locally and on Heroku:

    has_attached_file :icon,
        :url => "/system/:rails_env/:attachment/:style/:hash.:extension",
        :path => "public/system/:rails_env/:attachment/:style/:hash.:extension",
        :hash_data => ":class/:attachment/:id",
        :hash_secret => "superDuperSecret",
        :styles => { :medium => "300x300>", :thumb => "100x100>" },
        :default_url => "/blank.png"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Rails on Heroku Cedar stack and it's not throwing any issues while
I have a rails app running on Heroku. I am using paperclip for some
I just deployed my Rails app to Heroku, but the Javascripts that were using
I used Heroku in the past with Rails 3.0.9 using sqlite3 in development (locally).
I am trying to create a chat application on heroku using the following https://github.com/tarnfeld/PusherChat-Rails
Using Rails 3.2.2 and ruby 1.9.2 and I am not able to serve assets
Using Rails 3.1.3 with Ruby 1.9.3p0. I've discovered that by default, Rails does not
Using Rails 3.1.3 and Ruby 1.9.3. I want to give the user a list
We are using Rails 3.0.X and running our web app on Heroku. We are
I am using Authorize.net with Rails on Heroku. I have created a form to

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.