diff --git a/lib/mongo_mapper/plugins/associations/proxy.rb b/lib/mongo_mapper/plugins/associations/proxy.rb index 9a830cedc..493a05642 100644 --- a/lib/mongo_mapper/plugins/associations/proxy.rb +++ b/lib/mongo_mapper/plugins/associations/proxy.rb @@ -90,7 +90,7 @@ def respond_to?(*args) end def send(method, *args) - if proxy_respond_to?(method) + if proxy_respond_to?(method, true) super else load_target diff --git a/lib/mongo_mapper/plugins/dirty.rb b/lib/mongo_mapper/plugins/dirty.rb index 59dccb6d1..62842c5e5 100755 --- a/lib/mongo_mapper/plugins/dirty.rb +++ b/lib/mongo_mapper/plugins/dirty.rb @@ -23,13 +23,6 @@ def reload(*) super.tap { clear_changes } end - protected - - # We don't call super here to avoid invoking #attributes, which builds a whole new hash per call. - def attribute_method?(attr_name) - keys.key?(attr_name) || !embedded_associations.detect {|a| a.name == attr_name }.nil? - end - def clear_changes previous = changes (block_given? ? yield : true).tap do |result| @@ -40,6 +33,13 @@ def clear_changes end end + protected + + # We don't call super here to avoid invoking #attributes, which builds a whole new hash per call. + def attribute_method?(attr_name) + keys.key?(attr_name) || !embedded_associations.detect {|a| a.name == attr_name }.nil? + end + private def write_key(key, value) @@ -55,4 +55,4 @@ def attribute_value_changed?(key_name) end end end -end \ No newline at end of file +end