Skip to content

Commit

Permalink
Explain how to use the :href option for link_to_remote to degrade gra…
Browse files Browse the repository at this point in the history
…cefully in the absence of JavaScript. Closes rails#8911 [vlad]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8100 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
Marcel Molina committed Nov 6, 2007
1 parent 0230fc9 commit 563d9ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Explain how to use the :href option for link_to_remote to degrade gracefully in the absence of JavaScript. Closes #8911 [vlad]

* Disambiguate :size option for text area tag. Closes #8955 [redbeard]

* Fix broken tag in assert_tag documentation. Closes #9037 [mfazekas]
Expand Down
11 changes: 11 additions & 0 deletions actionpack/lib/action_view/helpers/prototype_helper.rb
Expand Up @@ -136,6 +136,17 @@ module PrototypeHelper
# default this is the current form, but
# it could just as well be the ID of a
# table row or any other DOM element.
#
# You can generate a link that uses AJAX in the general case, while
# degrading gracefully to plain link behavior in the absence of
# JavaScript by setting <tt>html_options[:href]</tt> to an alternate URL.
# Note the extra curly braces around the <tt>options</tt> hash separate
# it as the second parameter from <tt>html_options</tt>, the third.
#
# Example:
# link_to_remote "Delete this post",
# { :update => "posts", :url => { :action => "destroy", :id => post.id } },
# :href => url_for(:action => "destroy", :id => post.id)
def link_to_remote(name, options = {}, html_options = nil)
link_to_function(name, remote_function(options), html_options || options.delete(:html))
end
Expand Down

0 comments on commit 563d9ef

Please sign in to comment.