Sha256: 31fe9336dad38439406bbd7bc4fd5ec5c032ba82c57193f74bb6d487d2809104

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

class Collection < ActiveRecord::Base
  attr_accessible :is_visible, :products_count
  attr_accessible :name, :description, :name_en, :description_en, :name_ru, :description_ru, :products_attributes

  has_many :products

  has_one :picture, as: :assetable, dependent: :destroy, conditions: {is_main: true}
  has_many :pictures, as: :assetable, dependent: :destroy, conditions: {is_main: false}
  has_many :attachment_files, as: :assetable, dependent: :destroy

  fileuploads :picture, :pictures, :attachment_files
  translates :name, :description

  scope :visible, where(is_visible: true)
  scope :un_visible, where(is_visible: false)

  accepts_nested_attributes_for :products, allow_destroy: true

  alias_attribute :title, :name
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ab_admin-0.3.6 spec/dummy/app/models/collection.rb
ab_admin-0.3.5 spec/dummy/app/models/collection.rb
ab_admin-0.3.4 spec/dummy/app/models/collection.rb
ab_admin-0.3.3 spec/dummy/app/models/collection.rb