Link_to_remote fix, should this be added to edge rails?

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] )
end

any better suggestions on how this can be done?

cheers

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

Looks like someone else had the same feature request:
http://dev.rubyonrails.org/ticket/7904

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs