Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Photo < ActiveRecord::Base
- belongs_to :resort
- acts_as_list :scope => :resort
- default_scope :order => 'position'
- has_attached_file :data,
- :styles => { :original => '600x600>', :small => '200x200', :tiny => '100x100', :thumb => '64x64#', :iphone_thumb => '57x57#' }
- validates_attachment_presence :data
- validates_attachment_content_type :data,
- :content_type => ['image/jpeg', 'image/jpg']
- validates_attachment_size :data, :in => 0..3000.kilobytes
- #Add class method in Photo model
- def self.destroy_pics(resort, photos)
- Photo.find(photos, :conditions => {:resort_id => resort}).each(&:destroy)
- end
- end
Add Comment
Please, Sign In to add comment