lib/formtastic/inputs/base/collections.rb in formtastic-2.0.0.rc3 vs lib/formtastic/inputs/base/collections.rb in formtastic-2.0.0.rc4
- old
+ new
@@ -85,9 +85,16 @@
duck.call(object)
else
object.send(duck)
end
end
+
+ # Avoids an issue where `send_or_call` can be a String and duck can be something simple like
+ # `:first`, which obviously String responds to.
+ def send_or_call_or_object(duck, object)
+ return object if object.is_a?(String) # TODO what about other classes etc?
+ send_or_call(duck, object)
+ end
end
end
end
end