Ruby

Allow POST calls to a route

To allow POST calls to a route whitout get the "InvalidAuthenticityToken" error, the param "protect_from_forgery" is needed.

Put this line of code into the controller of the route that you will access by a POST call

protect_from_forgery prepend: true

example

routing

post 'post/route' => 'dummy#index'

controller

class DummyController < ApplicationController

  protect_from_forgery prepend: true

  def index
    render json: params
  end

end