Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check of argument #26524

Merged
merged 1 commit into from
Sep 22, 2016
Merged

add check of argument #26524

merged 1 commit into from
Sep 22, 2016

Conversation

y-yagi
Copy link
Member

@y-yagi y-yagi commented Sep 17, 2016

Summary

#fetch_multi in case did not cache hit, to write a cache using the block value.
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/cache.rb#L383..L384

Therefore, block is a need to pass always, I think should check first.

@rails-bot
Copy link

r? @schneems

(@rails-bot has picked a reviewer for you, use r? to override)

Copy link
Contributor

@maclover7 maclover7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 makes sense. Should we add anything to this method's documentation to make it more explicit that you need to pass a block?

@y-yagi
Copy link
Member Author

y-yagi commented Sep 17, 2016

Thank you for pointing out! I added the document. How about that?

@@ -361,6 +361,9 @@ def read_multi(*names)
# the cache with the given keys, then that data is returned. Otherwise,
# the supplied block is called for each key for which there was no data,
# and the result will be written to the cache and returned.
# Therefore, you need to pass a block that returns a data to be written
# to the cache. If you do not want to write the cache when the cache is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of that returns a data to, that returns the data to

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I updated!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why, but github still marked this as 'Needs change' when you clearly did the thing. Merging.

`#fetch_multi` in case did not cache hit, to write a cache using the block value.
https://github.com/rails/rails/blob/master/activesupport/lib/active_support/cache.rb#L383..L384

Therefore, block is a need to pass always, I think should check first.
@schneems schneems merged commit bf19c22 into rails:master Sep 22, 2016
@schneems
Copy link
Member

Thanks! 🚀

@y-yagi y-yagi deleted the add_check_of_argument branch September 22, 2016 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants