Skip to content

Commit

Permalink
Install responders
Browse files Browse the repository at this point in the history
  • Loading branch information
hab278 committed Jan 29, 2015
1 parent 8c9ebe1 commit d3c5162
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/dummy/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions test/dummy/config/locales/responders.en.yml
Original file line number Diff line number Diff line change
@@ -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.'
8 changes: 8 additions & 0 deletions test/dummy/lib/application_responder.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d3c5162

Please sign in to comment.