Skip to content

Commit

Permalink
paperclip with heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
drhenner committed Dec 19, 2014
1 parent e1c043d commit 758b0e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions config/application.rb
Expand Up @@ -66,6 +66,8 @@ class Application < Rails::Application
:verification_value]
# access any Settings here
config.after_initialize do
Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
#Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'

Paperclip::Attachment.default_options[:s3_protocol] = Settings.paperclip.s3_protocol
Paperclip::Attachment.default_options[:s3_credentials] = Settings.paperclip.s3_credentials.to_hash
Expand Down
8 changes: 1 addition & 7 deletions config/environments/production.rb
Expand Up @@ -140,18 +140,12 @@
#)
end

if ENV['FOG_DIRECTORY'].present?
PAPERCLIP__URL = "https://#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com/assets/products/:id/:style/:basename.:extension"
else
PAPERCLIP__URL = "/assets/products/:id/:style/:basename.:extension"
end
PAPERCLIP_STORAGE_OPTS = { styles: { :mini => '48x48>',
:small => '100x100>',
:medium => '200x200>',
:product => '320x320>',
:large => '600x600>' },
default_style: :product,
s3_host_name: "#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com",
url: PAPERCLIP__URL,
url: "/assets/products/:id/:style/:basename.:extension",
path: ":rails_root/public/assets/products/:id/:style/:basename.:extension" }
end

0 comments on commit 758b0e2

Please sign in to comment.