Rails: How Does csrf_meta_tag Work?

后端 未结 5 1699
灰色年华
灰色年华 2020-12-07 18:43

I\'m a PHP developer learning Ruby on Rails by reading Michael Hartl\'s tutorial. Here is a quote from the book, referring to csrf_meta_tag:

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-07 18:56

    csrf_meta_tags are indications for ajax requests to use these as one of the form parameters to make a request to the server. Rails expects the csrf as part of your form body (params) to process your requests. Using these meta tags you can construct the form body or the csrf header to suit your needs. I hope this answer helps your question.

提交回复
热议问题