[Rails] Re: Accessing the router from a helper

2010-04-21 Thread Thomas Allen
On Apr 21, 4:37 pm, Michael Pavling pavl...@gmail.com wrote: On 21 April 2010 20:36, Thomas Allen thomasmal...@gmail.com wrote: active = request.request_uri == url Would using url_for() not save you a lot of hassle generating that url? Thanks Michael, url_for was what I was looking for

Re: [Rails] Re: Accessing the router from a helper

2010-04-21 Thread Michael Pavling
On 21 April 2010 22:00, Thomas Allen thomasmal...@gmail.com wrote: On Apr 21, 4:37 pm, Michael Pavling pavl...@gmail.com wrote: On 21 April 2010 20:36, Thomas Allen thomasmal...@gmail.com wrote:    active = request.request_uri == url Would using url_for() not save you a lot of hassle

[Rails] Re: Accessing the router from a helper

2010-04-21 Thread Thomas Allen
Ah, that makes sense now. For the sake of correctness, the final code (with a yield and without the unused routes variable): def menu_item text, url = {} unless url[:access] and active_user.cannot? url[:access] unless url.is_a? String if url[:controller] url = url_for url