Allow identifiers to be defined with a block#110
Merged
mcclayton merged 1 commit intoprocore-oss:masterfrom Oct 26, 2018
Merged
Allow identifiers to be defined with a block#110mcclayton merged 1 commit intoprocore-oss:masterfrom
mcclayton merged 1 commit intoprocore-oss:masterfrom
Conversation
mcclayton
reviewed
Oct 22, 2018
|
|
||
| def self.inherited(subclass) | ||
| subclass.send(:view_collection).inherit(view_collection) | ||
| def self.identifier(method, name: method, extractor: AutoExtractor.new, &block) |
Contributor
There was a problem hiding this comment.
Would you mind adding to the method documentation for this and adding it to the README similar to how you did for the associations?
https://github.com/procore/blueprinter/blob/f849049fedf7adea5f13d11b2514b6c8b54f7efa/lib/blueprinter/base.rb#L124-L139
https://github.com/procore/blueprinter/blob/master/README.md#defining-an-association-directly-in-the-blueprint
| def self.inherited(subclass) | ||
| subclass.send(:view_collection).inherit(view_collection) | ||
| end | ||
| private_class_method :inherited |
AllPurposeName
approved these changes
Oct 22, 2018
Now that `::association` and `::field` receive an optional block, `::identifier` should receive it as well. Since all three methods receive an optional block, the block extraction mechanism was moved to `AutoExtractor`. Removing this mechanism from each individual method made them very similar. `::association` now uses `::field` instead of directly adding the field to the current view.
fa9f3ff to
22b04ff
Compare
Contributor
Author
|
I've added documentation. Feel free to suggest better examples, I used the one I needed on my project, but it may be a bit weird. |
philipqnguyen
approved these changes
Oct 26, 2018
Contributor
|
LGTM! |
mcclayton
approved these changes
Oct 26, 2018
Contributor
|
We’ll hopefully get this out soon in the next release of Blueprinter, thanks for this! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now that
::associationand::fieldreceive an optional block,::identifiershould receive it as well.Since all three methods receive an optional block, the block extraction
mechanism was moved to
AutoExtractor. Removing this mechanism fromeach individual method made them very similar.
::associationnow uses::fieldinstead of directly adding the field to the current view.Addresses #109