ruby on rails - Paperclip.interpolates randomly not returning a value -
i have following paperclip setup in model:
#paperclip photo has_attached_file :photo, :styles => { :large => '1024x758>', :medium => "200x150#", :small => "50x50>" }, :default_style => :original, :default_url => '/images/:attachment/default_:style.png', :path => ":instance_id/:attachment/:id/:version/:style/:basename.:extension", :storage => :s3, :s3_credentials => file.join(rails.root, 'config', 's3.yml'), :s3_protocol => 'https'
for instance_id have following:
paperclip.interpolates :instance_id |attachment, style| def instance_id(attachment, style) attachment.instance.instance_id end end
what's happening when first fire server, i'm noticing 404s images. had thought amazon s3, looked urls, , noticed instance_id not being returned paperclip.interpolates.
any idea why? have experienced this?
thanks
if understand correctly you're trying achieve, following should work:
paperclip.interpolates :instance_id |attachment, style| attachment.instance.instance_id end
fyi: interpolates proc defines method, doesn't something...
hope helps,
peter
Comments
Post a Comment