Sha256: 2261c999a4789b7e4bdea4d8095795506940f1c226a942fadd91e5bbdee1fbf5

Contents?: true

Size: 604 Bytes

Versions: 15

Compression:

Stored size: 604 Bytes

Contents

module Gluttonberg
  class AssetCollection < ActiveRecord::Base
      self.table_name = "gb_asset_collections"
      has_and_belongs_to_many :assets, :class_name => "Asset" , :join_table => "gb_asset_collections_assets"
      validates_uniqueness_of :name
      validates_presence_of :name
      attr_accessible :name
      def images
        data = assets.find(:all , :include => :asset_type )
        data.find_all{|d| d.category == "image"}
      end

      # this method is required for gallery form
      def name_with_number_of_images
        "#{name} (#{images.length} images)"
      end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gluttonberg-core-2.6.4 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.6.3 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.6.2 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.6.1 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.6.0 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.9 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.8 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.7 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.6 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.5 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.4 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.3 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.2 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5.1 app/models/gluttonberg/asset_collection.rb
gluttonberg-core-2.5 app/models/gluttonberg/asset_collection.rb