Sha256: 4f249e1597a6b352e8412ab3d4430512bdf4b0b3afde2acaa7d87bbb5c4e7747

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 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


      validates :title, :presence => true

      self.per_page = Refinery::PhotoGallery.collections_per_page

      def self.has_albums
        select("refinery_photo_gallery_collections.*").uniq.
            joins(:collection_albums).
            order('created_at DESC, title ASC')
      end

=begin
      def to_param
        "#{id}-#{title.parameterize}"
      end
=end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
refinerycms-photo-gallery-0.3.0 app/models/refinery/photo_gallery/collection.rb
refinerycms-photo-gallery-0.2.0 app/models/refinery/photo_gallery/collection.rb