Respuestas:
En Rails 4:
skip_before_action :verify_authenticity_token, except: [:create, :update, :destroy]
Y Rails 3:
skip_before_filter :verify_authenticity_token
Para versiones anteriores:
Para acciones individuales, puede hacer:
protect_from_forgery :only => [:update, :destroy, :create]
#or
protect_from_forgery :except => [:update, :destroy, :create]
Para un controlador completo, puede hacer:
skip_before_action :verify_authenticity_token
skip_forgery_protection
. Ver documentos de API .
En Rails4 usas skip_before_action
con except
o only
.
class UsersController < ApplicationController
skip_before_action :verify_authenticity_token, only: [:create]
skip_before_action :some_custom_action, except: [:new]
def new
# code
end
def create
# code
end
protected
def some_custom_action
# code
end
end