Link_to weirdness


#1

Hi,

I’ve got a page running at say http://example.com:3000/admin/players
Then I’ve this bit of code to generate a URL like:

http://example.com:3000/admin/players?order_col=fname&order_dir=desc

<%=link_to col[:label], :overwrite_params => {
:order_col => col[:field],
:order_dir => @order_dir == ‘asc’ ? ‘desc’ : ‘asc’ }%>

But instead it renders:

http://example.com:3000/admin/admin/players?order_col=fname&order_dir=desc

It’s doing ‘admin’ twice. Admin is a controller module (class
Admin::PlayersController < ApplicationController)

Anybody know what’s going on here…?

Jeroen


#2

Jeroen H. wrote:

But instead it renders:

http://example.com:3000/admin/admin/players?order_col=fname&order_dir=desc

Actually… This seems to work perfectly and with less code

<%=link_to col[:label], {
:order_col => col[:field],
:order_dir => @order_dir == ‘asc’ ? ‘desc’ : ‘asc’ }%>

Still don’t really understand the usage of :overwrite_params though…

Jeroen