11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/knitkit/extensions/active_record/acts_as_document.rb', line 11
def acts_as_document
extend ActsAsDocument::SingletonMethods
include ActsAsDocument::InstanceMethods
after_initialize :initialize_document
after_create :save_document
after_update :save_document
after_destroy :destroy_document
has_one :document, :as => :document_record
[:add_file, :files].each { |m| delegate m, :to => :document }
[
:add_dynamic_attribute,
:update_or_create_dynamic_attribute,
:update_first_dynamic_attribute_value_of_type,
:get_dynamic_attributes,
:get_dynamic_value_of_type,
:get_dynamic_attribute_of_type,
:has_dynamic_attribute_of_type?,
:destroy_dynamic_attribute_of_type
].each { |m| delegate m, :to => :document }
end
|