public Method

Route.defaults

Return a hash of key/value pairs representing the keys in the route that have defaults, or which are specified by non-regexp requirements.

Source Code

# File action_controller/routing/route.rb, line 198
def defaults
  @defaults ||= returning({}) do |hash|
    segments.each do |segment|
      next unless segment.respond_to? :default
      hash[segment.key] = segment.default unless segment.default.nil?
    end
    requirements.each do |key,req|
      next if Regexp === req || req.nil?
      hash[key] = req
    end
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.