Skip to content

Instantly share code, notes, and snippets.

@bs
Created November 10, 2008 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bs/23453 to your computer and use it in GitHub Desktop.
Save bs/23453 to your computer and use it in GitHub Desktop.
class Photo < ActiveRecord::Base
belongs_to :user
has_attached_file :file,
:styles => {
:bigger => "73x73>",
:normal => "48x48>",
:mini => "24x24>",
:flash_badge => '240x180!'
},
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/amazon_s3.yml",
:bucket => 'twitter_production',
:path => ":class/#{user_id}/:id/:style.:extension"
validates_attachment_presence :file
validates_attachment_size :file, :less_than => 700.kilobytes
validates_attachment_content_type :file, :content_type => ['image/jpeg', 'image/png', 'image/gif']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment