# How to get options from a URL string?

**URL:** <https://www.ruby-forum.com/t/how-to-get-options-from-a-url-string/104805>\
**Category:** Rails\
**Created:** [May 22, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/how-to-get-options-from-a-url-string/104805 "2007-05-22T20:11:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![starmaerker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@starmaerker](https://www.ruby-forum.com/u/starmaerker)\
**Post date:** [May 22, 2007, 8:11pm UTC](https://www.ruby-forum.com/t/how-to-get-options-from-a-url-string/104805/1 "2007-05-22T20:11:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![starmaerker](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e9bcb4/32.png) [@starmaerker](https://www.ruby-forum.com/u/starmaerker)\
**Post date:** [May 31, 2007, 2:12pm UTC](https://www.ruby-forum.com/t/how-to-get-options-from-a-url-string/104805/2 "2007-05-31T14:12:04Z")

</div>

> 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.
