How to get options from a URL string?

Hello,

I have some non-REST named routes, e.g. home_url, to hook up a couple
of static pages on my otherwise RESTful site.

I would like to use link_to_unless_current or current_page? but the
problem is those methods take an options hash rather than a url
string as generated by, say, home_url.

What’s the best way to reverse-engineer a URL into an options hash?
I know you can use hash_for_xxx for a RESTful route but that doesn’t
work with non-RESTful routes.

Thanks and regards,
Andy S.

I would like to use link_to_unless_current or current_page? but the
problem is those methods take an options hash rather than a url
string as generated by, say, home_url.

Just to tidy up loose ends, it turns out that the documentation is
wrong and link_to_unless_current and current_page? can both take a
url string.

Regards,
Andy S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs