app/controllers/application_controller.rb
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def current_user
  	if session[:user_id]
  		User.find(session[:user_id])
  	else
  		nil
		end
	rescue
		session.delete(:user_id)
		nil
  end
def current_user if session [ :user_id ] User . find ( session [ :user_id ] ) else nil end rescue session . delete ( :user_id ) nil end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .