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

added partial helper #72

Merged
merged 3 commits into from
Oct 31, 2018
Merged

Conversation

sio4
Copy link
Member

@sio4 sio4 commented Oct 31, 2018

Hi @markbates, and all buffalo lovers
I added plush's own partial helper. It does not directly affect any of applications using plush because of it just add new things. But for buffalo, the order to fill data/helper is important since it can be overrided by one of them. (Please consider minor version changing if needed.)

For references:
It related to issue "context not passed when partial used within for loop" (gobuffalo/buffalo#1406) and should be merged before PR for buffalo (gobuffalo/buffalo#1411) which depends on this change.

help.Context.data[k] = v
}

pf, ok := help.Context.data["partialFeeder"].(func(string) (string, error))
Copy link
Member

Choose a reason for hiding this comment

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

Type check against PartialFeeder here

Copy link
Member Author

Choose a reason for hiding this comment

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

Can I just use below here?

var pf PartialFeeder

I think it is just func(string) (string, error) so if the interface data["partialFeeder"] not match, it will not ok anyway.

@markbates
Copy link
Member

I’ll test this in a few hours when my day officially starts. :)

Can you write or test or two?

@sio4
Copy link
Member Author

sio4 commented Oct 31, 2018

Oh, I also think the same thing and I like test as much as buffalo (and your test kits) :-)
I just finished writing some test cases which has full coverage, after my dinner. I live in Korea (+0900) and few hours ago, I finished my official day :-) Have a good day!

help.Context.data[k] = v
}

pf, ok := help.Context.data["partialFeeder"].(func(string) (string, error))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pf, ok := help.Context.data["partialFeeder"].(func(string) (string, error))
pf, ok := help.Context.data["partialFeeder"].(PartialFeeder)

@markbates markbates merged commit b244719 into gobuffalo:master Oct 31, 2018
@sio4 sio4 deleted the partial_with_for_loop branch November 15, 2018 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants