Skip to content

Instantly share code, notes, and snippets.

@DefV
Created February 24, 2010 10:30
Show Gist options
  • Save DefV/313318 to your computer and use it in GitHub Desktop.
Save DefV/313318 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
class << self
def responder *responders
if responders.any?
responder_class = Class.new(ActionController::Responder)
responders.each do |responder|
responder = responder.is_a?(Module) ? responder : "#{responder.to_s.classify}Responder".constantize
responder_class.send(:include, responder)
end
self.responder = responder_class
else
super()
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment