Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Generate URL with array notation might accept a hash to build the query string #7246

Closed
Sephi-Chan opened this Issue · 4 comments

2 participants

@Sephi-Chan

To build a URL like /some_objects/42?foo=bar we can not use the array notation.

<%= link_to @some_object.name, [ @some_object, { foo: 'bar' } ] %>

Would you Rails team be interested in such a patch to url_for ?

@rafaelfranca
Owner

url_for already accepts an Array but it uses to generate the polymorphic_url like this:

polymorphic_url([:admin, blog, post]) # => "http://example.com/admin/blogs/1/posts/1"

I have mixed felling about this. Maybe it is useful, but I only have sure seem the implementation and more examples. Please go ahead and open a pull request.

@rafaelfranca
Owner

Also I think is better to send this to the Rails core mailing list. I'm closing this since it is not an issue neither a pull request and we are not using the issue tracker to feature request/suggestion.

@Sephi-Chan

Thanks @rafaelfranca, I'll try it and send a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.