Module: Annotations::Acts::AnnotationValue::ClassMethods

Defined in:
lib/annotations/acts_as_annotation_value.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_annotation_value(options) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/annotations/acts_as_annotation_value.rb', line 11

def acts_as_annotation_value(options)
  cattr_accessor :ann_value_content_field, :is_annotation_value
  
  if options[:content_field].blank?
    raise ArgumentError.new("Must specify the :content_field option that will be used as the field for the content")
  end
  
  self.ann_value_content_field = options[:content_field] 
  
  has_many :annotations,
           :as => :value
           
  has_many :annotation_value_seeds,
           :as => :value
   
  __send__ :extend, SingletonMethods
  __send__ :include, InstanceMethods
  
  self.is_annotation_value = true
end