Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

default_url is being shown for styles not marked to be processed in background #107

Closed
patrickbajao opened this issue Sep 4, 2014 · 0 comments · Fixed by #108
Closed

Comments

@patrickbajao
Copy link

Hi,

I seem to be encountering a bug wherein the default_url is being returned for styles that I didn't mark to be process in background. I'm using the latest gem version (2.8.0).

Here's my paperclip setup:

has_attached_file :photo, {
  styles: {
    large: ['400x400#', :jpg],
    small: ['200x200#', :jpg]
  },
  path: "photos/items/:id/:style/:basename.:extension",
  default_url: "//localhost:3000/assets/items/missing/:style.jpg",
  only_process: [:large]
}

process_in_background :photo, only_process: [:small]

Then here's a test I run in my console to replicate this bug:

2.0.0-p353 :005 > i.photo = File.open("sample.jpg")
2.0.0-p353 :006 > i.save
2.0.0-p353 :007 > i.photo.url(:large)
 => "//localhost:3000/assets/items/missing/large.jpg"
2.0.0-p353 :008 > i.photo.url(:small)
 => "//localhost:3000/assets/items/missing/small.jpg"

I expect small to return the default url but I expect large to return the actual URL for the image since it was not processed in background. Even when I reload (using i.reload) the object, it's the same thing.

Looking at the commit history, it seems that it should be fixed by this commit. Though this issue I'm encountering doesn't seem to be covered by the test cases in that commit. So I'm not sure if this is a regression or something else.

Hope someone can shed a light on this issue. Thanks in advance! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant