aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2018-06-07 21:39:08 +0300
committerbogdanvlviv <bogdanvlviv@gmail.com>2018-06-07 21:47:43 +0300
commit1ae1099ed4c47d82b18a2ba8a9028ab06aff1f29 (patch)
tree3bb18cb5180e14caf2e0c00c9edb1b5a7ff17fa1 /guides
parent35730055174c3b4b4dd2b08fc743e425310d5131 (diff)
downloadrails-1ae1099ed4c47d82b18a2ba8a9028ab06aff1f29.tar.gz
rails-1ae1099ed4c47d82b18a2ba8a9028ab06aff1f29.tar.bz2
rails-1ae1099ed4c47d82b18a2ba8a9028ab06aff1f29.zip
Fix example of `index_with`
- Clarify executor of `public_send`. - Do not wrap `Interval.all_day` into [] since an array is expected as a returned value. Related to #32523. [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_support_core_extensions.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 057651e0cf..8c9a890a4d 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -2045,10 +2045,10 @@ The method `index_with` generates a hash with the elements of an enumerable as k
is either a passed default or returned in a block.
```ruby
-%i( title body created_at ).index_with { |attr_name| public_send(attr_name) }
+%i( title body created_at ).index_with { |attr_name| post.public_send(attr_name) }
# => { title: "hey", body: "what's up?", … }
-WEEKDAYS.index_with([ Interval.all_day ])
+WEEKDAYS.index_with(Interval.all_day)
# => { monday: [ 0, 1440 ], … }
```