From 8de04a6cab1781506c7ec9e519b52f6614f1151a Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Mon, 29 Aug 2011 17:50:51 -0700 Subject: [PATCH] Set flash in application controller --- app/controllers/application_controller.rb | 11 +++++++++++ app/controllers/info_window_controller.rb | 5 ----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e8065d9..89e14d3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,14 @@ class ApplicationController < ActionController::Base 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 diff --git a/app/controllers/info_window_controller.rb b/app/controllers/info_window_controller.rb index 42a4ea4..29f7a61 100644 --- a/app/controllers/info_window_controller.rb +++ b/app/controllers/info_window_controller.rb @@ -1,11 +1,6 @@ class InfoWindowController < ApplicationController def index @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 user_signed_in? && current_user.id == @hydrant.user_id render("users/thank_you")