mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Update the guides.
This commit is contained in:
@@ -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+
|
||||
|
||||
Reference in New Issue
Block a user