Forum: Ruby on Rails link_to problem when used in folder

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.
Cheltis (Guest)
on 2006-03-01 13:03
I have split my appliction into 2 folders - public and restricted areas:
"site" and "admin"

Now, in "site" i have a "search" controller with the "results" action. I
want to make a link that will keep all the parameters of the link

<%= link_to 'link', params %>

However, instead of something like:

http://localhost:3000/site/search/results?price_fr...

I get the following

http://localhost:3000/site/site/search/results?pri...

As you can see "site" is dublicated in the url showing up as "site/site"

if I debug params I get the following:

!ruby/hash:HashWithIndifferentAccess reg_year_to: price_from: "0"
transmission_id: fuel_type_id: reg_year_from: metallic: action: results
color_id: make_id: category_id: *controller: site/search* used:
order_by: price mileage_to: mileage_from: "0" price_to: model_id:

The way to workaround this for me was to add the following code:

params.update({:controller => controller.controller_name, :action =>
controller.action_name})

however, clearly this is not the way it should be... am I doing
something wrong or is it a bug?
This topic is locked and can not be replied to.