@@ -5,20 +5,19 @@ module DynamicAccessors
55 class << self
66
77 def define_accessors ( attribute , value , object )
8- klass = object . class
98 if attribute . to_s . end_with? ( '_at' ) && attribute . to_s != 'update_last_request_at'
10- define_date_based_accessors ( attribute , value , klass )
9+ define_date_based_accessors ( attribute , value , object )
1110 elsif object . flat_store_attribute? ( attribute )
12- define_flat_store_based_accessors ( attribute , value , klass )
11+ define_flat_store_based_accessors ( attribute , value , object )
1312 else
14- define_standard_accessors ( attribute , value , klass )
13+ define_standard_accessors ( attribute , value , object )
1514 end
1615 end
1716
1817 private
1918
20- def define_flat_store_based_accessors ( attribute , value , klass )
21- klass . class_eval %Q"
19+ def define_flat_store_based_accessors ( attribute , value , object )
20+ object . instance_eval %Q"
2221 def #{ attribute } =(value)
2322 mark_field_as_changed!(:#{ attribute } )
2423 @#{ attribute } = Intercom::Lib::FlatStore.new(value)
@@ -29,8 +28,8 @@ def #{attribute}
2928 "
3029 end
3130
32- def define_date_based_accessors ( attribute , value , klass )
33- klass . class_eval %Q"
31+ def define_date_based_accessors ( attribute , value , object )
32+ object . instance_eval %Q"
3433 def #{ attribute } =(value)
3534 mark_field_as_changed!(:#{ attribute } )
3635 @#{ attribute } = value.nil? ? nil : value.to_i
@@ -41,8 +40,8 @@ def #{attribute}
4140 "
4241 end
4342
44- def define_standard_accessors ( attribute , value , klass )
45- klass . class_eval %Q"
43+ def define_standard_accessors ( attribute , value , object )
44+ object . instance_eval %Q"
4645 def #{ attribute } =(value)
4746 mark_field_as_changed!(:#{ attribute } )
4847 @#{ attribute } = value
0 commit comments