Last active
December 14, 2015 13:58
-
-
Save nakaearth/5097145 to your computer and use it in GitHub Desktop.
Stamp.rbのPaperclipのサンプル抜粋
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>",stamps:"350x350>"},url:":s3_domain_url",path:"stamps/:style/:filename" | |
else | |
has_attached_file :stamp, url: "/:style/:img_dir_num/:filename" , styles: {stamps_s:"100x100>",stamps:"350x350>"} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
スペーシング的なとこだけ直しました
https://gist.github.com/hito-asa/5290921