Production bug fix pundit
This commit is contained in:
parent
a75631552f
commit
0bcca5be87
@ -15,16 +15,19 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def flash_to_http_header
|
|
||||||
return unless request.xhr?
|
|
||||||
return if flash.empty?
|
|
||||||
response.headers['X-FlashMessages'] = flash.to_hash.to_json
|
|
||||||
flash.discard # don't want the flash to appear when you reload page
|
|
||||||
end
|
|
||||||
|
|
||||||
def user_not_authorized
|
def user_not_authorized
|
||||||
flash[:alert] = 'Access denied.'
|
flash[:alert] = 'Access denied.'
|
||||||
redirect_to (request.referrer || root_path)
|
redirect_to (request.referrer || root_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def flash_to_http_header
|
||||||
|
return unless request.xhr?
|
||||||
|
return if flash.empty?
|
||||||
|
response.headers['X-FlashMessages'] = flash.to_hash.to_json
|
||||||
|
flash.discard # don't want the flash to appear when you reload page
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user