Disabling protect_from_forgery for test environment

4 views
Skip to first unread message

Ganesh Kumar

unread,
Jul 18, 2017, 10:08:55 AM7/18/17
to Ruby on Rails: Talk
I have put this code to disable protect_from_forgery for test environment. The code is given below and i have given the code in bold. that is the one i'm talking about..

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception, unless: -> { Rails.env.test? }
end


I have currently put this code in application controller. is there a better place put this code? I need some advice here.. can anyone advise me please?
Reply all
Reply to author
Forward
0 new messages