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.
unknown (Guest)
on 2005-12-22 23: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:removed_email_address@domain.invalid
Abdur-Rahman A. (Guest)
on 2005-12-22 23:39
(Received via mailing list)
Hi,

I myself use map.search :controller => 'search', that works for me..
Peter D. (Guest)
on 2005-12-23 00:54
(Received via mailing list)
Hi,

On 12/23/05, removed_email_address@domain.invalid 
<removed_email_address@domain.invalid> 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
This topic is locked and can not be replied to.