Module: ProductAttribute

Defined in:
lib/dragonfly_extensions/product_attribute.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/dragonfly_extensions/product_attribute.rb', line 2

def self.included(base)
  base.table_name = 'taggings'
  base.belongs_to :tag
  base.belongs_to :taggable, :polymorphic => true
  base.belongs_to :tagger,   :polymorphic => true
  
  # base.default_scope :joins => [:tag, :taggable]#, :order => "#{Tag.table_name}.name ASC"
  # base.named_scope :all, :select => "DISTINCT #{Tagging.table_name}.*", :conditions => "#{Tagging.table_name}.context = '#{base.model_name.downcase.pluralize}'"
  base.named_scope :all, :conditions => "#{Tagging.table_name}.context = '#{base.model_name.downcase.pluralize}'"

end

Instance Method Details

#nameObject



14
15
16
# File 'lib/dragonfly_extensions/product_attribute.rb', line 14

def name
  self.tag.name
end