Skip to content

Instantly share code, notes, and snippets.

@jcarley
Created December 29, 2011 18:09
Show Gist options
  • Save jcarley/1535346 to your computer and use it in GitHub Desktop.
Save jcarley/1535346 to your computer and use it in GitHub Desktop.
Rails model with paperclip has_attached_file method
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :username, :realname, :email, :password, :password_confirmation, :encrypted_password, :avatar
has_attached_file :avatar,
:storage => :s3,
:bucket => '<s3 bucket name>',
:s3_credentials => {
:access_key_id => ENV['S3_KEY'],
:secret_access_key => ENV['S3_SECRET']
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment