Skip to content

Instantly share code, notes, and snippets.

@hito-asa
Forked from nakaearth/Stamp.rb
Last active December 15, 2015 16:39
Show Gist options
  • Save hito-asa/5290921 to your computer and use it in GitHub Desktop.
Save hito-asa/5290921 to your computer and use it in GitHub Desktop.
class Stamp < ActiveRecord::Base
####途中省略####
if Rails.env.production?
S3_CREDENTIALS = {access_key_id: ENV['S3_ACCESS_KEY_ID'], secret_access_key: ENV['S3_SECRET_KEY'], bucket: "hoge-bucket"}
end
if Rails.env.production?
has_attached_file :stamp, storage: :s3, s3_credentials: S3_CREDENTIALS,
styles: {stamps_s: "100x100&gt;", stamps: "350x350&gt;"}, url: ":s3_domain_url", path: "stamps/:style/:filename"
else
has_attached_file :stamp, url: "/:style/:img_dir_num/:filename", styles: {stamps_s: "100x100&gt;", stamps: "350x350&gt;"}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment