11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/annotations/acts_as_annotatable.rb', line 11
def acts_as_annotatable(options)
cattr_accessor :annotatable_name_field, :is_annotatable
if options[:name_field].blank?
raise ArgumentError.new("Must specify the :name_field option that will be used as the field for the name")
end
self.annotatable_name_field = options[:name_field]
has_many :annotations,
:as => :annotatable,
:dependent => :destroy,
:order => 'updated_at ASC'
__send__ :extend, SingletonMethods
__send__ :include, InstanceMethods
self.is_annotatable = true
end
|