Advertisement
Guest User

Untitled

a guest
Mar 17th, 2011
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. class Photo < ActiveRecord::Base
  2. attr_accessible :album_id, :description, :photo
  3.  
  4. belongs_to :album
  5. has_many :comments, :as => :commentable
  6.  
  7. has_attached_file :photo, :styles => { :big => "683x512", :medium => "120x120#", :thumb => "50x50#" },
  8. :url => "/assets/photos/:id/:style/:basename.:extension",
  9. :path => ":rails_root/public/assets/photos/:id/:style/:basename.:extension"
  10.  
  11. validates_attachment_size :photo, :less_than => 2.megabytes
  12. validates_attachment_content_type :photo, :content_type => [ 'image/jpeg', 'image/gif', 'image/png' ]
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement