[Rails] link_to problem when used in folder

Cheltis cheltis at gmail.com
Wed Mar 1 11:03:00 GMT 2006


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_from=0&order_by=price&mileage_from=0

I get the following

http://localhost:3000/site/site/search/results?price_from=0&order_by=price&mileage_from=0

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?

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list