aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r--activesupport/CHANGELOG.md11
1 files changed, 10 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 6830360eba..b32c97bead 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,6 +1,15 @@
* Added yield to Object#presence, so you can do this:
- person.presence { |p| p.name.first } || 'Nobody'
+ project.account.owner.presence { |p| p.name.first } || 'Nobody'
+
+ instead of calling twice (which may incur double SQL calls):
+
+ project.account.owner ? project.account.owner.name.first || 'Nobody'
+
+ or assigning to local variable:
+
+ owner = project.account.owner
+ owner ? owner.name.first || 'Nobody'
*DHH*