Clear all mime types in respond_to.
# File lib/action_controller/metal/mime_responds.rb, line 57 57: def clear_respond_to 58: self.mimes_for_respond_to = ActiveSupport::OrderedHash.new.freeze 59: end
Defines mime types that are rendered by default when invoking respond_with.
Examples:
respond_to :html, :xml, :json
Specifies that all actions in the controller respond to requests for :html, :xml and :json.
To specify on per-action basis, use :only and :except with an array of actions or a single action:
respond_to :html respond_to :xml, :json, :except => [ :edit ]
This specifies that all actions respond to :html and all actions except :edit respond to :xml and :json.
respond_to :rjs, :only => :create
This specifies that the :create action and no other responds to :rjs.
# File lib/action_controller/metal/mime_responds.rb, line 39 39: def respond_to(*mimes) 40: options = mimes.extract_options! 41: 42: only_actions = Array(options.delete(:only)) 43: except_actions = Array(options.delete(:except)) 44: 45: new = mimes_for_respond_to.dup 46: mimes.each do |mime| 47: mime = mime.to_sym 48: new[mime] = {} 49: new[mime][:only] = only_actions unless only_actions.empty? 50: new[mime][:except] = except_actions unless except_actions.empty? 51: end 52: self.mimes_for_respond_to = new.freeze 53: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.