Sha256: f06e517f06b116d5be9dea1c99ad65f51004135dad1fdaa0951f3c3567998b5f
Contents?: true
Size: 1.1 KB
Versions: 6
Compression:
Stored size: 1.1 KB
Contents
module DynamicController module ClassMethods def parent_resources @parent_resources ||= [] end def include_action?(action_name) (@resource_options[:only] - @resource_options[:except]).include?(action_name) end def redefined_responders @redefined_responders ||= {} end def redefined_responder_to(action, format=nil) redefined_responders[redefined_responder_key(action, format)] end def redefined_responder_to?(action, format=nil) redefined_responders.has_key? redefined_responder_key(action, format) end def responder_formats @responder_formats ||= [:html, :json] end DynamicController::ACTIONS.each do |action| define_method "respond_to_#{action}" do |format=nil, &block| responder_formats << format if format and !responder_formats.include?(format) redefined_responders[redefined_responder_key(action, format)] = block end end private def redefined_responder_key(action, format=nil) [action, format].compact.join('_').to_sym end end end
Version data entries
6 entries across 6 versions & 1 rubygems