Update try to work with rails 4.0

This commit is contained in:
jrhe 2013-04-03 11:18:20 +02:00
parent 747282d6e5
commit baf5e6eacb
1 changed files with 2 additions and 2 deletions

View File

@ -192,11 +192,11 @@ class Object
# @person.try(:name)
#
# File activesupport/lib/active_support/core_ext/object/try.rb#L32
def try(*a, &b)
def try(*a, &b)
if a.empty? && block_given?
yield self
else
__send__(*a, &b)
public_send(*a, &b) if respond_to?(a.first)
end
end
end