From fae4264a7efe2df4890b5f1095bd7454e3bcb939 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Valim?= <jose.valim@gmail.com>
Date: Sun, 14 Nov 2010 16:22:21 +0100
Subject: Update the guides.

---
 railties/guides/source/active_support_core_extensions.textile | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'railties/guides/source/active_support_core_extensions.textile')

diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index 8c11b2a11a..dc1200812e 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -167,6 +167,12 @@ def log_info(sql, name, ms)
 end
 </ruby>
 
++try+ can also be called without arguments but a block, which will only be executed if the object is not nil:
+
+<ruby>
+@person.try { |p| "#{p.first_name} #{p.last_name}" }
+</ruby>
+
 NOTE: Defined in +active_support/core_ext/object/try.rb+.
 
 h4. +singleton_class+
-- 
cgit v1.2.3

