aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-11-14 16:22:21 +0100
committerJosé Valim <jose.valim@gmail.com>2010-11-14 16:22:21 +0100
commitfae4264a7efe2df4890b5f1095bd7454e3bcb939 (patch)
tree71393853de1f305f7d8dcd135e9519ac71a2bde1 /railties/guides/source
parent88688cdd8e467d4bdebfa3f08e47cd5e7c5ead2c (diff)
downloadrails-fae4264a7efe2df4890b5f1095bd7454e3bcb939.tar.gz
rails-fae4264a7efe2df4890b5f1095bd7454e3bcb939.tar.bz2
rails-fae4264a7efe2df4890b5f1095bd7454e3bcb939.zip
Update the guides.
Diffstat (limited to 'railties/guides/source')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile6
1 files changed, 6 insertions, 0 deletions
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+