Class: ExportedCatalogItem

Inherits:
ApplicationRecord show all
Defined in:
app/models/exported_catalog_item.rb

Overview

== Schema Information

Table name: exported_catalog_items
Database name: primary

id :integer not null, primary key
created_at :datetime not null
updated_at :datetime not null
catalog_item_id :integer
exported_catalog_item_packet_id :integer

Indexes

idx_exported_catalog_items_unique (exported_catalog_item_packet_id,catalog_item_id) UNIQUE

Belongs to collapse

Has many collapse

Has and belongs to many collapse

Delegated Instance Attributes collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Instance Method Details

#catalog_itemCatalogItem



18
# File 'app/models/exported_catalog_item.rb', line 18

belongs_to :catalog_item

#exported_catalog_item_imagesActiveRecord::Relation<ExportedCatalogItemImage>

Returns:

See Also:



20
# File 'app/models/exported_catalog_item.rb', line 20

has_many :exported_catalog_item_images, inverse_of: :exported_catalog_item

#exported_catalog_item_literaturesActiveRecord::Relation<ExportedCatalogItemLiterature>

Returns:

  • (ActiveRecord::Relation<ExportedCatalogItemLiterature>)

See Also:



21
# File 'app/models/exported_catalog_item.rb', line 21

has_many :exported_catalog_item_literatures

#exported_catalog_item_packetExportedCatalogItemPacket



17
# File 'app/models/exported_catalog_item.rb', line 17

belongs_to :exported_catalog_item_packet

#image_attributesObject



29
30
31
# File 'app/models/exported_catalog_item.rb', line 29

def image_attributes
  exported_catalog_item_packet.exported_catalog_item_packet_image_attributes.where(selected: true)
end

#itemObject

Alias for Catalog_item#item

Returns:

  • (Object)

    Catalog_item#item

See Also:



27
# File 'app/models/exported_catalog_item.rb', line 27

delegate :item, to: :catalog_item, allow_nil: true

#product_specificationsActiveRecord::Relation<ProductSpecification>

Returns:

See Also:



24
# File 'app/models/exported_catalog_item.rb', line 24

has_and_belongs_to_many :product_specifications

#publicationsActiveRecord::Relation<Item>

Returns:

  • (ActiveRecord::Relation<Item>)

See Also:



23
# File 'app/models/exported_catalog_item.rb', line 23

has_and_belongs_to_many :publications, class_name: 'Item'

#publications_for_selectObject



33
34
35
# File 'app/models/exported_catalog_item.rb', line 33

def publications_for_select
  catalog_item.item.all_my_publications.map{|p| [p.name, p.id]}.sort_by{|o| o.first.upcase }
end

#skuObject

Alias for Catalog_item#sku

Returns:

  • (Object)

    Catalog_item#sku

See Also:



26
# File 'app/models/exported_catalog_item.rb', line 26

delegate :sku, to: :catalog_item, allow_nil: true