Sha256: e5a1ce439800863d9c47d4ab4c39d816735890a24e25542ffc52ead68d6eb0a1

Contents?: true

Size: 530 Bytes

Versions: 10

Compression:

Stored size: 530 Bytes

Contents

module Tenon
  class Gallery < ActiveRecord::Base
    include Tenon::Reorderable
    has_many :photos, inverse_of: :gallery, dependent: :destroy
    accepts_nested_attributes_for :photos, allow_destroy: true, reject_if: ->(p) { p[:file_id].blank? }
    validates_presence_of :title
    validates_uniqueness_of :title
    default_scope { order('tenon_galleries.list_order') }
    has_history includes: [:photos]

    def self.find_with_photos(id)
      includes(:photos).order('tenon_photos.list_order').find(id)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tenon-1.1.8 app/models/tenon/gallery.rb
tenon-1.1.7 app/models/tenon/gallery.rb
tenon-1.1.6 app/models/tenon/gallery.rb
tenon-1.1.5 app/models/tenon/gallery.rb
tenon-1.1.4 app/models/tenon/gallery.rb
tenon-1.1.3 app/models/tenon/gallery.rb
tenon-1.1.2 app/models/tenon/gallery.rb
tenon-1.1.1 app/models/tenon/gallery.rb
tenon-1.0.76 app/models/tenon/gallery.rb
tenon-1.0.75 app/models/tenon/gallery.rb