how to generate AuthenticityToken on rails

前端 未结 4 1063
说谎
说谎 2021-01-03 17:26

I build the form tag by myself and when I post the form to server it give me a InvalidAuthenticityToken error, so I want to know how to add it in my own in curr

4条回答
  •  执笔经年
    2021-01-03 18:16

    This answer is first for rails form token tag in Google so to keep it simpler for future googling generations: just use token_tag, it's a helper defined in ActionView::Helpers::UrlHelper that returns hidden input with form_authenticity_token as default value.

提交回复
热议问题