Refactor button_to helper to use token_tag method #4532

Merged
merged 2 commits into from Jan 19, 2012

Conversation

Projects
None yet
3 participants
Owner

rafaelfranca commented Jan 18, 2012

Also I added one test case to button_to with request forgery protection enabled and removed
some TODO notes

Contributor

josevalim commented Jan 19, 2012

I don't think we need to create a new module. Maybe we could move token_tag to TagHelper or somewhere else?

Owner

rafaelfranca commented Jan 19, 2012

Ok. I'll move to UrlHelper. What did you think?

Owner

rafaelfranca commented Jan 19, 2012

@josevalim done

josevalim added a commit that referenced this pull request Jan 19, 2012

Merge pull request #4532 from rafaelfranca/av-button_to-refactor
Refactor button_to helper to use token_tag method

@josevalim josevalim merged commit 5caf1bd into rails:master Jan 19, 2012

I think that one would read even better if you were to do the it like this:

return '' if token == false || !protect_against_forgery?
# ... rest ....
Owner

rafaelfranca replied Jan 21, 2012

I don't see too much improvements in this way.

Owner

rafaelfranca replied Jan 21, 2012

I mean, in terms of flow the code works in the same way. But I agree that changing it to post-condition syntax may improve the readability. In this case I only pull down the method without refactor it. But if you want, please send a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment