Sha256: a21abf75c820a557fcbed82dcb90e2ca2817ed6c45f314a382d9196f10081dd9
Contents?: true
Size: 497 Bytes
Versions: 11
Compression:
Stored size: 497 Bytes
Contents
class Gallery < ActiveRecord::Base include Forge::Reorderable has_many :photos accepts_nested_attributes_for :photos, :allow_destroy => true, :reject_if => lambda { |p| p[:file_asset_id].blank? && p[:id].blank? } validates_presence_of :title validates_uniqueness_of :title default_scope { order('galleries.list_order') } # open up everything for mass assignment attr_protected def self.find_with_photos(id) includes(:photos).order('photos.list_order').find(id) end end
Version data entries
11 entries across 11 versions & 1 rubygems