Archive: ComponentOwl Rails app, DB backups, go redirect script
This commit is contained in:
16
config/initializers/paperclip.rb
Normal file
16
config/initializers/paperclip.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
Paperclip.interpolates(:product_code) do |attachment, style|
|
||||
attachment.instance.product.code
|
||||
end
|
||||
|
||||
Paperclip.interpolates(:size) do |attachment, style|
|
||||
attachment.instance.size
|
||||
end
|
||||
|
||||
Paperclip.interpolates(:timestamp) do |attachment, style|
|
||||
attachment.instance_read(:updated_at).in_time_zone(7).strftime("%s")
|
||||
end
|
||||
|
||||
Paperclip.interpolates(:s3_url) do |attachment, style|
|
||||
path = attachment.path(style)
|
||||
"#{attachment.s3_protocol}://#{Settings.uploadable_asset_host % (path.hash % 4)}/#{path.gsub(%r{^/}, "")}"
|
||||
end
|
||||
Reference in New Issue
Block a user