Permalink
Browse files

unnecessary reference to link_to_remote method in rails 4.0 [ci skip]

  • Loading branch information...
1 parent 7ed3890 commit f20f230a588369a7876d5a7bc03efee3c3028200 Francesco Rodriguez committed Jun 16, 2012
Showing with 30 additions and 23 deletions.
  1. +30 −23 guides/source/ajax_on_rails.textile
@@ -1,6 +1,8 @@
h2. AJAX on Rails
-This guide covers the built-in Ajax/JavaScript functionality of Rails (and more); it will enable you to create rich and dynamic AJAX applications with ease! We will cover the following topics:
+This guide covers the built-in Ajax/JavaScript functionality of Rails (and more);
+it will enable you to create rich and dynamic AJAX applications with ease! We will
+cover the following topics:
* Quick introduction to AJAX and related technologies
* Unobtrusive JavaScript helpers with drivers for Prototype, jQuery etc
@@ -10,23 +12,25 @@ endprologue.
h3. Hello AJAX - a Quick Intro
-AJAX is about updating parts of a web page, without reloading the page. An AJAX call happens as a
-response to an event, like when the page finished loading or when a user clicks on an element. For
-example, let say you click on a link, which would usually take you to a new page, but instead of
-doing that, an asynchronous HTTP request is made and the response is evaluated with javascript.
-That way the page is not reloaded, and new information can be dynamically included in the page.
-The way that happens is by inserting, removing or changing parts of the DOM. The DOM, or
-Document Object Model, is a convention to represent the HTML document as a set of nodes that contain
-other nodes. For example a list of names is represented as a @ul@ element node containing several
-@li@ element nodess. An AJAX call can be made to obtain a new list item to include, and append it
-inside a @li@ node to the @ul@ node.
+AJAX is about updating parts of a web page, without reloading the page. An AJAX
+call happens as a response to an event, like when the page finished loading or
+when a user clicks on an element. For example, let say you click on a link, which
+would usually take you to a new page, but instead of doing that, an asynchronous
+HTTP request is made and the response is evaluated with javascript. That way the
+page is not reloaded, and new information can be dynamically included in the page.
+The way that happens is by inserting, removing or changing parts of the DOM. The
+DOM, or Document Object Model, is a convention to represent the HTML document as
+a set of nodes that contain other nodes. For example a list of names is represented
+as a @ul@ element node containing several @li@ element nodess. An AJAX call can
+be made to obtain a new list item to include, and append it inside a @li@ node to
+the @ul@ node.
h4. Asynchronous JavaScript + XML
-AJAX means Asynchronous JavaScript + XML. Asynchronous means that the page is not reloaded, the
-request made is separate from the regular page request. Javascript is used to evaluate the response
-and the XML part is a bit misleading as XML is not required, you respond to the HTTP request with
-JSON or regular HTML as well.
+AJAX means Asynchronous JavaScript + XML. Asynchronous means that the page is not
+reloaded, the request made is separate from the regular page request. Javascript
+is used to evaluate the response and the XML part is a bit misleading as XML is
+not required, you respond to the HTTP request with JSON or regular HTML as well.
h4. The DOM
@@ -38,18 +42,21 @@ How do 'standard' and AJAX requests differ, why does this matter for understandi
h3. Built-in Rails Helpers
-Rails 3.1 ships with "jQuery":http://jquery.com as the default JavaScript library. The Gemfile contains <tt>gem 'jquery-rails'</tt> which makes the jQuery files available to the application automatically. This can be accessed as:
+Rails 4.0 ships with "jQuery":http://jquery.com as the default JavaScript library.
+The Gemfile contains <tt>gem 'jquery-rails'</tt> which makes the jQuery files
+available to the application automatically. This can be accessed as:
<ruby>
javascript_include_tag :defaults
</ruby>
h4. Examples
-All the remote_method helpers has been removed. To make them working with AJAX, simply pass the <tt>:remote => true</tt> option to the original non-remote method.
+To make them working with AJAX, simply pass the <tt>remote: true</tt> option to
+the original non-remote method.
<ruby>
-button_to "New", :action => "new", :form_class => "new-thing"
+button_to 'New', action: 'new', form_class: 'new-thing'
</ruby>
will produce
@@ -61,7 +68,7 @@ will produce
</html>
<ruby>
-button_to "Create", :action => "create", :remote => true, :form => { "data-type" => "json" }
+button_to 'Create', action: 'create', remote: true, form: { 'data-type' => 'json' }
</ruby>
will produce
@@ -73,8 +80,8 @@ will produce
</html>
<ruby>
-button_to "Delete Image", { :action => "delete", :id => @image.id },
- :confirm => "Are you sure?", :method => :delete
+button_to 'Delete Image', { action: 'delete', id: @image.id },
+ confirm: 'Are you sure?', method: :delete
</ruby>
will produce
@@ -89,8 +96,8 @@ will produce
</html>
<ruby>
-button_to('Destroy', 'http://www.example.com', :confirm => 'Are you sure?',
- :method => "delete", :remote => true, 'data-disable-with' => 'loading...')
+button_to 'Destroy', 'http://www.example.com', confirm: 'Are you sure?',
+ method: 'delete', remote: true, 'data-disable-with' => 'loading...')
</ruby>
will produce

0 comments on commit f20f230

Please sign in to comment.