开发者

Rails 3.1rc6 rake asset:precompile breaks paperclip default images

I have the following paperclip setup in one of my models:

has_attached_file :avatar,  :styles => {
                            :large =>  "#{APP_CONFIG["uploads"]["images"]["size"]["large"]}>",
                            :profile => "#{APP_CONFIG["uploads"]["images"]["size"]["profile"]}",
                            :medium => "#{APP_CONFIG["uploads"]["images"]["size"]["medium"]}>",
                            :small =>  "#{APP_CONFIG["uploads"]["images"]["size"]["small"]}>",
                            :thumb =>  "#{APP_CONFIG["uploads"]["images"]["size"]["thumb"]}>" },
                          :path =>        "#{APP_CONFIG["uploads"]["path"]}/users/:style/:id/:basename.:extension",
                          :url =>         "#{APP_CONFIG["uploads"]["url"]}/users/:style/:id/:basename.:extension",
                          :default_url => "/assets/paperclip_missing/user_missing_:style.png"

Now, when I rake assets:precompile RAILS_ENV=staging, the default images cannot be found any more. The file system shows the files with the compiled md5-hash in the name, like so: user_missing_small-iamalongmd5hash.png.

All image_tags reference the correct image, even with the compiled image names, but paperclip does not seem to work that way. Any idea how I can circumvent 开发者_如何转开发this issue? Thanks!


I found a solution! In case you have the same problem, remove the /assets/ from the default_url path (note that there is no "/" in front of the path):

:default_url => "paperclip_missing/user_missing_:style.png"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜