Set flash in application controller
This commit is contained in:
parent
8e9f963a68
commit
8de04a6cab
|
@ -1,3 +1,14 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
|
before_filter :set_flash_from_params
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def set_flash_from_params
|
||||||
|
if params[:flash]
|
||||||
|
params[:flash].each do |key, message|
|
||||||
|
flash.now[key.to_sym] = message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
class InfoWindowController < ApplicationController
|
class InfoWindowController < ApplicationController
|
||||||
def index
|
def index
|
||||||
@hydrant = Hydrant.find_by_id(params[:hydrant_id])
|
@hydrant = Hydrant.find_by_id(params[:hydrant_id])
|
||||||
if params[:flash]
|
|
||||||
params[:flash].each do |key, message|
|
|
||||||
flash.now[key.to_sym] = message
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if @hydrant.adopted?
|
if @hydrant.adopted?
|
||||||
if user_signed_in? && current_user.id == @hydrant.user_id
|
if user_signed_in? && current_user.id == @hydrant.user_id
|
||||||
render("users/thank_you")
|
render("users/thank_you")
|
||||||
|
|
Loading…
Reference in New Issue