method
url_for
v4.1.8 -
Show latest stable
- Class:
ActionDispatch::Routing::RouteSet
url_for(options)public
The options argument must be nil or a hash whose keys are symbols.
# File actionpack/lib/action_dispatch/routing/route_set.rb, line 649
def url_for(options)
options = default_url_options.merge(options || {})
user, password = extract_authentication(options)
recall = options.delete(:_recall)
original_script_name = options.delete(:original_script_name).presence
script_name = options.delete(:script_name).presence || _generate_prefix(options)
if script_name && original_script_name
script_name = original_script_name + script_name
end
path_options = options.except(*RESERVED_OPTIONS)
path_options = yield(path_options) if block_given?
path, params = generate(path_options, recall || {})
params.merge!(options[:params] || {})
ActionDispatch::Http::URL.url_for(options.merge!({
:path => path,
:script_name => script_name,
:params => params,
:user => user,
:password => password
}))
end Related methods
- Instance methods
- _generate_prefix
- add_route
- append
- call
- clear!
- define_mounted_helper
- draw
- empty?
- eval_block
- extra_keys
- finalize!
- generate
- generate_extras
- mounted?
- mounted_helpers
- optimize_routes_generation?
- prepend
- recognize_path
- url_for
- url_helpers
- Class methods
- default_resources_path_names
- new
- Private methods
-
build_conditions -
build_path -
extract_authentication