Skip to content

Instantly share code, notes, and snippets.

@baldwindavid
Created September 23, 2009 21:07
Show Gist options
  • Save baldwindavid/192275 to your computer and use it in GitHub Desktop.
Save baldwindavid/192275 to your computer and use it in GitHub Desktop.
has_attached_file :attachment,
:path => ":class/:id/:style_:basename.:extension",
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:s3_host_alias => "assets.whatever.com",
:url => RAILS_ENV == "production" ? ":s3_alias_url" : ":s3_path_url"
has_attached_file :image,
:path => ":class/:id/:style_:basename.:extension",
:styles => {:custom => Proc.new {|i| "#{i.image_width}x#{i.image_height}>"}},
:default_style => :custom,
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:s3_host_alias => "assets.whatever.com",
:url => RAILS_ENV == "production" ? ":s3_alias_url" : ":s3_path_url"
development:
bucket: testing.assets.whatever.com
access_key_id: XXXX
secret_access_key: XXXX
test:
bucket: testing.assets.whatever.com
access_key_id: XXXX
secret_access_key: XXXX
production:
bucket: assets.whatever.com
access_key_id: XXXX
secret_access_key: XXXX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment