7

button_to: Support `authenticity_token:` option by seanpdoyle · Pull Request #43...

 2 years ago
source link: https://github.com/rails/rails/pull/43417
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

seanpdoyle commented on Oct 9

edited

Match support for passing authenticity_token: in form_with and
form_for calls.

button_to "Create", Post.new, authenticity_token: false
  # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button></form>

button_to "Create", Post.new, authenticity_token: true
  # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="abc123..." autocomplete="off" /></form>

button_to "Create", Post.new, authenticity_token: "secret"
  # => <form class="button_to" method="post" action="/posts"><button type="submit">Create</button><input type="hidden" name="form_token" value="secret" autocomplete="off" /></form>

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK