Method: ActionDispatch::Routing::RouteSet#url_for
- Defined in:
- actionpack/lib/action_dispatch/routing/route_set.rb
#url_for(options, route_name = nil, url_strategy = UNKNOWN, method_name = nil, reserved = RESERVED_OPTIONS) ⇒ Object
The options argument must be a hash whose keys are symbols.
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 845 def url_for(, route_name = nil, url_strategy = UNKNOWN, method_name = nil, reserved = RESERVED_OPTIONS) = .merge user = password = nil if [:user] && [:password] user = .delete :user password = .delete :password end recall = .delete(:_recall) { {} } original_script_name = .delete(:original_script_name) script_name = find_script_name if original_script_name script_name = original_script_name + script_name end = .dup reserved.each { |ro| .delete ro } route_with_params = generate(route_name, , recall) path = route_with_params.path(method_name) if [:trailing_slash] && ![:format] && !path.end_with?("/") path += "/" end params = route_with_params.params if .key? :params if [:params].respond_to?(:to_hash) params.merge! [:params] else params[:params] = [:params] end end [:path] = path [:script_name] = script_name [:params] = params [:user] = user [:password] = password url_strategy.call end |