diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-09-12 02:13:59 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-09-12 02:13:59 +0000 |
commit | 8a7d73cf4d3a92fd0546949f32c78fefffcb8bab (patch) | |
tree | a4888c9e1e0e8537766d95b5f5343afb769fabe0 /actionpack/lib/action_view | |
parent | c70fd5df7fd8af3a50539d6edf9c3453d2f892e8 (diff) | |
download | rails-8a7d73cf4d3a92fd0546949f32c78fefffcb8bab.tar.gz rails-8a7d73cf4d3a92fd0546949f32c78fefffcb8bab.tar.bz2 rails-8a7d73cf4d3a92fd0546949f32c78fefffcb8bab.zip |
Tidy up link to remote options. Closes #9505. [nik.wakelin]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7468 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 4ece6f8709..cc8c5ad54f 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -45,6 +45,13 @@ module ActionView # :url => { :action => "destroy", :id => post.id } # link_to_remote(image_tag("refresh"), :update => "emails", # :url => { :action => "list_emails" }) + # + # You can override the generated HTML options by specifying a hash in + # <tt>options[:html]</tt>. + # + # link_to_remote "Delete this post", :update => "posts", + # :url => post_url(@post), :method => :delete, + # :html => { :class => "destructive" } # # You can also specify a hash for <tt>options[:update]</tt> to allow for # easy redirection of output to an other DOM element if a server-side @@ -129,8 +136,8 @@ module ActionView # default this is the current form, but # it could just as well be the ID of a # table row or any other DOM element. - def link_to_remote(name, options = {}, html_options = {}) - link_to_function(name, remote_function(options), html_options) + def link_to_remote(name, options = {}, html_options = nil) + link_to_function(name, remote_function(options), html_options || options.delete(:html)) end # Periodically calls the specified url (<tt>options[:url]</tt>) every |