Methods

Class Index [+]

Quicksearch

ActionController::Head

Public Instance Methods

head(status, options = {}) click to toggle source

Return a response that has no content (merely headers). The options argument is interpreted to be a hash of header names and values. This allows you to easily return a response that consists only of significant headers:

  head :created, :location => person_path(@person)

It can also be used to return exceptional conditions:

  return head(:method_not_allowed) unless request.post?
  return head(:bad_request) unless valid_request?
  render
    # File lib/action_controller/metal/head.rb, line 17
17:     def head(status, options = {})
18:       options, status = status, nil if status.is_a?(Hash)
19:       status ||= options.delete(:status) || :ok
20:       location = options.delete(:location)
21: 
22:       options.each do |key, value|
23:         headers[key.to_s.dasherize.split(/-/).map { |v| v.capitalize }.join("-")] = value.to_s
24:       end
25: 
26:       self.status = status
27:       self.location = url_for(location) if location
28:       self.content_type = Mime[formats.first] if formats
29:       self.response_body = " "
30:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.