From d3c5162d7ad196e7d556085f62e49376b4168e74 Mon Sep 17 00:00:00 2001 From: hab278 Date: Thu, 29 Jan 2015 13:51:57 -0500 Subject: [PATCH] Install responders --- test/dummy/app/controllers/application_controller.rb | 5 +++++ test/dummy/config/locales/responders.en.yml | 12 ++++++++++++ test/dummy/lib/application_responder.rb | 8 ++++++++ 3 files changed, 25 insertions(+) create mode 100644 test/dummy/config/locales/responders.en.yml create mode 100644 test/dummy/lib/application_responder.rb diff --git a/test/dummy/app/controllers/application_controller.rb b/test/dummy/app/controllers/application_controller.rb index d83690e..b64f11b 100644 --- a/test/dummy/app/controllers/application_controller.rb +++ b/test/dummy/app/controllers/application_controller.rb @@ -1,4 +1,9 @@ +require "application_responder" + class ApplicationController < ActionController::Base + self.responder = ApplicationResponder + respond_to :html + # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception diff --git a/test/dummy/config/locales/responders.en.yml b/test/dummy/config/locales/responders.en.yml new file mode 100644 index 0000000..c3e147a --- /dev/null +++ b/test/dummy/config/locales/responders.en.yml @@ -0,0 +1,12 @@ +en: + flash: + actions: + create: + notice: '%{resource_name} was successfully created.' + # alert: '%{resource_name} could not be created.' + update: + notice: '%{resource_name} was successfully updated.' + # alert: '%{resource_name} could not be updated.' + destroy: + notice: '%{resource_name} was successfully destroyed.' + alert: '%{resource_name} could not be destroyed.' diff --git a/test/dummy/lib/application_responder.rb b/test/dummy/lib/application_responder.rb new file mode 100644 index 0000000..cc3e588 --- /dev/null +++ b/test/dummy/lib/application_responder.rb @@ -0,0 +1,8 @@ +class ApplicationResponder < ActionController::Responder + include Responders::FlashResponder + include Responders::HttpCacheResponder + + # Redirects resources to the collection path (index action) instead + # of the resource path (show action) for POST/PUT/DELETE requests. + # include Responders::CollectionResponder +end