Permalink
Browse files

Fix Ruby 2.0 breakage caused by behavior changes to #respond_to? - fi…

…xes #473
  • Loading branch information...
1 parent 197c2f6 commit eb232a94ceabc9c57af0fd44637679783c048e10 @cheald cheald committed Nov 3, 2012
Showing with 9 additions and 9 deletions.
  1. +1 −1 lib/mongo_mapper/plugins/associations/proxy.rb
  2. +8 −8 lib/mongo_mapper/plugins/dirty.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
@@ -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
+end

0 comments on commit eb232a9

Please sign in to comment.