method

generate

generate()
public

No documentation available.

# File actionpack/lib/action_dispatch/routing/route_set.rb, line 451
        def generate
          path, params = @set.set.generate(:path_info, named_route, options, recall, PARAMETERIZE)

          raise_routing_error unless path

          return [path, params.keys] if @extras

          [path, params]
        rescue Rack::Mount::RoutingError
          raise_routing_error
        end

1Note

False query string parameters removed

yaz ยท Aug 19, 2014

This method is used in url_for (therefore in redirects as well).

If you pass a query string parameter to a url route that is false, before Rails 3.1, the generate method would reject it.

This causes issues on the redirected page if you are depending on the param to be have a specific value.

In Rails 3.2 they remove params.reject! {|k,v| !v.to_param} altogether.

So every single param you send is a string.