Paperclip generating wrong URLs in Heroku

Posted by Tony on Stack Overflow See other posts from Stack Overflow or by Tony
Published on 2012-09-08T21:08:03Z Indexed on 2012/09/08 21:38 UTC
Read the original article Hit count: 155

Paperclip is generating wrong URLs in Heroku.

I have an Audio model which has a mp3 field as follows:

class Audio < ActiveRecord::Base
    has_attached_file :mp3,
    :storage => :s3,
    :s3_credentials => S3_CREDENTIALS,
    :bucket => S3_CREDENTIALS[:bucket],
    :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
    :url => "/system/:attachment/:id/:style/:filename"

I am calling audio.mp3.url from a controller, and it returns

http://s3.amazonaws.com/MyApp/audios/mp3s//original/96a9ae89302fdf8462ee05eb829f2e17578b144e20120908-2-11f61zr.mp3?1347135050

instead of

http://s3.amazonaws.com/MyApp/audios/mp3s/000/000/004/original/96a9ae89302fdf8462ee05eb829f2e17578b144e20120908-2-11f61zr.mp3?1347135050 (which works)

Why is it missing the '000/000/004' part of the route?

The same model is generating the right URL when used in a view.

Any help?

I am using paperclip 3.2.0 and Rails 3.1.8. Any help?

© Stack Overflow or respective owner

Related posts about heroku

Related posts about ruby-on-rails-3.1