Reputation: 483
my default image is broken when it tries to load.
my code:
has_attached_file :background, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "default-logo.png"
validates_attachment_content_type :background, :content_type => /\Aimage\/.*\Z/
Rendered:
Failed to load resource: the server responded with a status of 404 (Not Found) http://test.dev/default-logo.png
default-logo.png
is located in my assets/images
folder. Why is it now showing up?
Upvotes: 0
Views: 768
Reputation: 13354
You need to explicitly set the path in the has_attached_file
line of code to tell Paperclip exactly where to look for your default image. What I have used in the past is ActionController::Base.helpers.asset_path
, passing in the asset file name.
So, for your code, try:
has_attached_file :background, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => ActionController::Base.helpers.asset_path("default-logo.png")
Upvotes: 2