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

Version Path
forge-cli-0.1.10 lib/forge/app/models/gallery.rb
forge-cli-0.1.9 lib/forge/app/models/gallery.rb
forge-cli-0.1.8 lib/forge/app/models/gallery.rb
forge-cli-0.1.7 lib/forge/app/models/gallery.rb
forge-cli-0.1.6 lib/forge/app/models/gallery.rb
forge-cli-0.1.5 lib/forge/app/models/gallery.rb
forge-cli-0.1.4 lib/forge/app/models/gallery.rb
forge-cli-0.1.3 lib/forge/app/models/gallery.rb
forge-cli-0.1.2 lib/forge/app/models/gallery.rb
forge-cli-0.1.1 lib/forge/app/models/gallery.rb
forge-cli-0.1.0 lib/forge/app/models/gallery.rb