Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…xes #473
  • Loading branch information...
commit eb232a94ceabc9c57af0fd44637679783c048e10 1 parent 197c2f6
@cheald cheald authored
View
2  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
View
16 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
+end
Please sign in to comment.
Something went wrong with that request. Please try again.