Flowdock
method

url_for

Importance_0
v4.0.2 - Show latest stable - 0 notes - Class: ActionDispatch::Http::URL
url_for(options = {}) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_dispatch/http/url.rb, line 32
        def url_for(options = {})
          options = options.dup
          path  = options.delete(:script_name).to_s.chomp("/")
          path << options.delete(:path).to_s

          params = options[:params].is_a?(Hash) ? options[:params] : options.slice(:params)
          params.reject! { |_,v| v.to_param.nil? }

          result = build_host_url(options)
          if options[:trailing_slash]
            if path.include?('?')
              result << path.sub(/\?/, '/\&')
            else
              result << path.sub(/[^\/]\z|\A\z/, '\&/')
            end
          else
            result << path
          end
          result << "?#{params.to_query}" unless params.empty?
          result << "##{Journey::Router::Utils.escape_fragment(options[:anchor].to_param.to_s)}" if options[:anchor]
          result
        end
Register or log in to add new notes.