Iacutone.rb

coding and things

Submitting a Get Request in Rails

| Comments

For the error “WARNING: Can’t verify CSRF token authenticity”, add a CSRF token.

_form.html.haml
1
2
3
4
= form_tag some_path(@organization), method: :get do
  = hidden_field_tag :authenticity_token, form_authenticity_token # this needs to be added!
  = submit_tag "View"
  = link_to_function 'Export', "Javascript function which posts to another route"

The top-level block contains method: :get which doesn’t auto-add the needed authenticity_token.

Helpful Links

Understanding the Rails Authenticity Token

Comments