Sha256: c57c1ecc61267d57ea32caab32c0b306fb25994944e3943b38b1baee2dbd7eca

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

module Refinery
  module PhotoGallery
    class Collection < ActiveRecord::Base
      has_many :collection_albums
      has_many :albums, :through => :collection_albums

      #TODO Allow to remove collection only if no album belongs to it

      attr_accessible :title, :description

      validates :title, :presence => true
      acts_as_indexed :fields => [:title, :description]

      self.per_page = Refinery::PhotoGallery.collections_per_page

      scope :has_albums, lambda {
        select("refinery_photo_gallery_collections.*").uniq.
            joins(:collection_albums).
            order('created_at DESC, title ASC')
      }
=begin
      def to_param
        "#{id}-#{title.parameterize}"
      end
=end

    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
refinerycms-6hoursdaily-photo-gallery-0.0.5.dev app/models/refinery/photo_gallery/collection.rb
refinerycms-6hoursdaily-photo-gallery-0.0.4.dev app/models/refinery/photo_gallery/collection.rb
refinerycms-photo-gallery-0.0.2.dev app/models/refinery/photo_gallery/collection.rb
refinerycms-photo-gallery-0.0.1.dev app/models/refinery/photo_gallery/collection.rb