Forum: Ruby on Rails link_to weirdness

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.
B9a732fc30c32098347a0177c75ee27b?d=identicon&s=25 jeroen (Guest)
on 2005-11-20 00:51
(Received via mailing list)
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=fn...

<%=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_...

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

Anybody know what's going on here..?

Jeroen
B9a732fc30c32098347a0177c75ee27b?d=identicon&s=25 jeroen (Guest)
on 2005-11-20 12:07
(Received via mailing list)
Jeroen Houben wrote:
>
> But instead it renders:
>
> http://example.com:3000/admin/admin/players?order_...


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
This topic is locked and can not be replied to.