Forum: Ruby on Rails routes and url_for

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
03bdb9a03ca4554cf1dd5f8a10c95e0b?d=identicon&s=25 unknown (Guest)
on 2005-12-22 22:30
(Received via mailing list)
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:timurv@hitv.ru
03cb7371db223067d0daab54e1f95cb2?d=identicon&s=25 Abdur-Rahman Advany (Guest)
on 2005-12-22 22:39
(Received via mailing list)
Hi,

I myself use map.search :controller => 'search', that works for me..
67b6389be42524fbd776e44fd35c3d7e?d=identicon&s=25 Peter Donald (Guest)
on 2005-12-22 23:54
(Received via mailing list)
Hi,

On 12/23/05, timurv@hitv.ru <timurv@hitv.ru> 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 Donald

Blog: http://www.RealityForge.org
This topic is locked and can not be replied to.