Forum: Ruby on Rails link_to_remote fix, should this be added to edge rails?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
D1d01b729c5d5d5c46d042ab6fa6b6ac?d=identicon&s=25 adam (Guest)
on 2007-05-11 00:17
After looking at the link_to_remote tag for the first time, I found it
broke when javascript was disabled.

Below is one possible solution I found and would like to suggest that
this idea is promoted into rails.

    # provide fix for link_to_remote tag when javascript is not enabled
    def link_to_remote_fix(text, options)
        link_to_remote text, options, :href => url_for( options[:url] )

any better suggestions on how this can be done?

00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2007-05-11 17:24
(Received via mailing list)
On 11 May 2007, at 00:17, adam wrote:

>         link_to_remote text, options, :href => url_for( options
> [:url] )
>     end
> any better suggestions on how this can be done?

Your method is correct, you could however alias link_to_remote to
old_link_to_remote and then override the link_to_remote method. This
way, all your existing code will benefit from it. Keep in mind that
you need to provide seperate normal pages for each action you call
via link_to_remote so that it will render if Javascript is disabled.

Best regards

Peter De Berdt
8bc543795b502900b5333aea73ad5533?d=identicon&s=25 Eden Li (edenli)
on 2007-05-12 09:34
(Received via mailing list)
Looks like someone else had the same feature request:

I think it's a good idea, but maybe as an option.  A lot of the time
you don't want your link_to_remote to actually get triggered if
Javascript is disabled because the end point is an rjs action or
something else not for human consumption.
This topic is locked and can not be replied to.