Closed vitr closed 6 years ago
Code in documentation is probably for older versions of Buffalo.
What works for me:
// render.go
Helpers: render.Helpers {
"csrf": func(helper plush.HelperContext) template.HTML {
t, _ := helper.Render("<input name=\"authenticity_token\" value=\"<%= authenticity_token %>\" type=\"hidden\">")
return template.HTML(t)
},
},
Steps to Reproduce the Problem
Follow 'How Do I Handle CSRF Tokens If I Use My Own Form?' on the docs page https://gobuffalo.io/en/docs/forms
Expected Behavior
The template should render to value of actual token, the same token as in the header
renders to
Actual Behavior
In fact, the code from the docs renders to
See the variable authenticity_token hasn't been translated into actual value. I'd appreciate if either documentation or code will be corrected. Thank you.
p.s. I think here is the related issue https://github.com/mikaelm1/Blog-App-Buffalo/issues/4
Info