Routes and url_for

Hi, All.

I try to relocate controllers. Admin space controlers moved to
/app/controllers/admin and user space controllers to
/app/controllers/user

In routes.rb I use

map.connect ‘search’, :controller => ‘user/search’

that correct I see.

But when I want to use start_form_tag or simply url_for, that used in
start_form_tag, I do not know how generate url like /search, becouse
url_tag return url corresponding with routes.rb rules:

/user/search

So, what is the right way to do this?


timurv mailto:[email protected]

Hi,

I myself use map.search :controller => ‘search’, that works for me…

Hi,

On 12/23/05, [email protected] [email protected] wrote:

But when I want to use start_form_tag or simply url_for, that used in
start_form_tag, I do not know how generate url like /search, becouse
url_tag return url corresponding with routes.rb rules:

/user/search

So, what is the right way to do this?

If I understand the question correctly I think you need to add a ‘/’
at the start of the controller name. Something like the following;

link_to(‘Search’, :controller => ‘/search’)
link_to(‘User Profile’, :controller => ‘/user/profile’)
link_to(‘Admin Audit Log’, :controller => ‘/admin/auditlog’)


Cheers,

Peter D.

Blog: http://www.RealityForge.org