78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'app/models/activity_object/properties.rb', line 78
def property_reflections objects, options = {}
objects.each do |o|
source = options[:source] || o
conditions = options[:conditions] && { type: o.to_s.classify } || nil
attr_reader "add_holder_#{ o }_id"
has_many o.to_s.tableize, through: :property_objects, source: source, conditions: conditions
has_one "main_#{ o }", through: :main_property_object, source: source, conditions: conditions
has_many "holder_#{ o.to_s.tableize }", through: :holder_objects, source: source, conditions: conditions
has_many "main_holder_#{ o.to_s.tableize }", through: :main_holder_objects, source: source, conditions: conditions
end
end
|