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

Block is not called with arg(s) as doc'd #546

Closed
quartzmo opened this issue Feb 9, 2016 · 2 comments
Closed

Block is not called with arg(s) as doc'd #546

quartzmo opened this issue Feb 9, 2016 · 2 comments
Assignees
Labels
api: datastore Issues related to the Datastore API.

Comments

@quartzmo
Copy link
Member

quartzmo commented Feb 9, 2016

The last doc example for Entity#exclude_from_indexes! shows the method passing the property value(s) as a parameter to the block argument, but I do not see this in the code:

The example:

entity["age"] = 21
entity.exclude_from_indexes! "age" do |age|
   age > 18
end
@quartzmo quartzmo added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: datastore Issues related to the Datastore API. labels Feb 9, 2016
@blowmage
Copy link
Contributor

That method simply stores the block as a Proc object to be used for that field name. The value is passed to the Proc object here and here, but this happens after all the field values are stored and right before saving.

@blowmage blowmage removed the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Feb 10, 2016
@quartzmo
Copy link
Member Author

Now I understand it! Thank you for linking that together for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API.
Projects
None yet
Development

No branches or pull requests

2 participants