From 65ee3d76b345973188eeeecfa1c5537854816ba0 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 18:27:10 -0700 Subject: [PATCH 01/42] Updated link to RubyGems site --- guides/source/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 76556761f7..f963a31ca4 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -24,7 +24,7 @@ with Rails. However, to get the most out of it, you need to have some prerequisites installed: * The [Ruby](http://www.ruby-lang.org/en/downloads) language version 1.9.3 or higher -* The [RubyGems](http://rubyforge.org/frs/?group_id=126) packaging system +* The [RubyGems](http://rubygems.org/) packaging system * To learn more about RubyGems, please read the [RubyGems User Guide](http://docs.rubygems.org/read/book/1) * A working installation of the [SQLite3 Database](http://www.sqlite.org) From c332393f751fdbd2bf1c821e2ac1fa5f06fea7b6 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 21:02:48 -0700 Subject: [PATCH 02/42] Update version numbers of Ruby and Rails --- guides/source/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index f963a31ca4..76a2a3c1be 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -81,7 +81,7 @@ Open up a command line prompt. On a mac this is called terminal, on windows it i ```bash $ ruby -v -ruby 1.9.3p194 +ruby 1.9.3p327 ``` To install Rails, use the `gem install` command provided by RubyGems: @@ -100,7 +100,7 @@ To verify that you have everything installed correctly, you should be able to ru $ rails --version ``` -If it says something like "Rails 3.2.8" you are ready to continue. +If it says something like "Rails 3.2.9" you are ready to continue. ### Creating the Blog Application From 85db49fd8d7a14cc0126f1a2516effbea33d715f Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 21:37:53 -0700 Subject: [PATCH 03/42] Modified "Allowing the update of fields" section * Rails generate model Post ______ creates the attr_accessible line for you for any fields you specify. Changed the section to describe what this line in the model does. --- guides/source/getting_started.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 76a2a3c1be..546230dbdd 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -693,6 +693,7 @@ The model file, `app/models/post.rb` is about as simple as it can get: ```ruby class Post < ActiveRecord::Base + attr_accessible :text, :title end ``` @@ -702,18 +703,11 @@ your Rails models for free, including basic database CRUD (Create, Read, Update, Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another. -Rails includes methods to help you secure some of your model fields. -Open the `app/models/post.rb` file and edit it: - -```ruby -class Post < ActiveRecord::Base - attr_accessible :text, :title -end -``` - -This change will ensure that all changes made through HTML forms can edit the content of the text and title fields. -It will not be possible to define any other field value through forms. You can still define them by calling the `field=` method of course. -Accessible attributes and the mass assignment problem is covered in details in the [Security guide](security.html#mass-assignment) +Rails includes methods to help you secure some of your model fields. The Rails +model generator added the attr_accessible line to your model file. This change +will ensure that all changes made through HTML forms can edit the content of +the text and title fields. Accessible attributes and the mass assignment problem is covered in +details in the [Security guide](security.html#mass-assignment) ### Adding Some Validation From a22fc4abf12f618b25cc2e127971d43d43eb98c4 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 22:24:29 -0700 Subject: [PATCH 04/42] Changed the Using Partials section to read a little better * No need to give a simple example, as we have a partial that we create in the blog app --- guides/source/getting_started.md | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 546230dbdd..6528759041 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -954,35 +954,14 @@ And here's how our app looks so far: ### Using partials to clean up duplication in views -`partials` are what Rails uses to remove duplication in views. Here's a -simple example: - -```html+erb -# app/views/user/show.html.erb - -

<%= @user.name %>

- -<%= render 'user_details' %> - -# app/views/user/_user_details.html.erb - -<%= @user.location %> - -<%= @user.about_me %> -``` - -The `users/show` template will automatically include the content of the -`users/_user_details` template. Note that partials are prefixed by an underscore, -as to not be confused with regular views. However, you don't include the -underscore when including them with the `helper` method. +Our `edit` page looks very similar to the `new` page, in fact they +both share the same code for displaying the form. Let's remove some duplication +by using a view partial. By convention, partial files are prefixed by an +underscore. TIP: You can read more about partials in the [Layouts and Rendering in Rails](layouts_and_rendering.html) guide. -Our `edit` action looks very similar to the `new` action, in fact they -both share the same code for displaying the form. Let's clean them up by -using a partial. - Create a new file `app/views/posts/_form.html.erb` with the following content: From 3e8c4bc6c62a7995821c6835e3314a1411cec43b Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 22:25:32 -0700 Subject: [PATCH 05/42] Added new line to make it more readable * This shows the reader there is a method: and data: parameters --- guides/source/getting_started.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 6528759041..64435c0d5b 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1123,7 +1123,8 @@ together. <%= post.text %> <%= link_to 'Show', action: :show, id: post.id %> <%= link_to 'Edit', action: :edit, id: post.id %> - <%= link_to 'Destroy', { action: :destroy, id: post.id }, method: :delete, data: { confirm: 'Are you sure?' } %> + <%= link_to 'Destroy', { action: :destroy, id: post.id }, + method: :delete, data: { confirm: 'Are you sure?' } %> <% end %> From 9314867b1fefffa4c5a1a876886fde6655bd2dae Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 22:37:50 -0700 Subject: [PATCH 06/42] Moved position of has_many --- guides/source/getting_started.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 64435c0d5b..c517d23e40 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1292,6 +1292,7 @@ makes each comment belong to a Post: ```ruby class Comment < ActiveRecord::Base belongs_to :post + attr_accessible :body, :commenter end ``` @@ -1299,10 +1300,10 @@ You'll need to edit the `post.rb` file to add the other side of the association: ```ruby class Post < ActiveRecord::Base + has_many :comments validates :title, presence: true, length: { minimum: 5 } - - has_many :comments + [...] end ``` From c94cfdad6388dcdfaf4c10b9e8cee46baf2a7901 Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 22:41:30 -0700 Subject: [PATCH 07/42] Updated with where functional/helper tests go --- guides/source/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index c517d23e40..76389cc33a 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1347,9 +1347,9 @@ This creates six files and one empty directory: | -------------------------------------------- | ---------------------------------------- | | app/controllers/comments_controller.rb | The Comments controller | | app/views/comments/ | Views of the controller are stored here | -| test/controllers/comments_controller_test.rb | The test for the controller | +| test/functional/comments_controller_test.rb | The test for the controller | | app/helpers/comments_helper.rb | A view helper file | -| test/helpers/comments_helper_test.rb | The test for the helper | +| test/unit/helpers/comments_helper_test.rb | The test for the helper | | app/assets/javascripts/comment.js.coffee | CoffeeScript for the controller | | app/assets/stylesheets/comment.css.scss | Cascading style sheet for the controller | From 45f0fead7a5ea9ab0eaab41bf08d47ec1e309bcc Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 22:56:56 -0700 Subject: [PATCH 08/42] We should use post_path, not post_url --- guides/source/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 76389cc33a..18cf6873ee 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1403,7 +1403,7 @@ class CommentsController < ApplicationController def create @post = Post.find(params[:post_id]) @comment = @post.comments.create(params[:comment]) - redirect_to post_url(@post) + redirect_to post_path(@post) end end ``` From f9793a121e5653655a14ba9cf60dce480e42dbce Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sat, 24 Nov 2012 22:57:21 -0700 Subject: [PATCH 09/42] Reword Post model to note there are lines not shown --- guides/source/getting_started.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 18cf6873ee..4273f2d95c 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1654,9 +1654,10 @@ model, `app/models/post.rb`, as follows: ```ruby class Post < ActiveRecord::Base + has_many :comments, dependent: :destroy validates :title, presence: true, length: { minimum: 5 } - has_many :comments, dependent: :destroy + [...] end ``` From 064ae350dc8764dd10f2274a4293780b0210339c Mon Sep 17 00:00:00 2001 From: Jason Noble Date: Sun, 25 Nov 2012 12:02:01 -0700 Subject: [PATCH 10/42] Revert "Updated with where functional/helper tests go" This reverts commit c94cfdad6388dcdfaf4c10b9e8cee46baf2a7901. * This is the new 4.0 (master) directory structure --- guides/source/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 4273f2d95c..78af810af9 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1347,9 +1347,9 @@ This creates six files and one empty directory: | -------------------------------------------- | ---------------------------------------- | | app/controllers/comments_controller.rb | The Comments controller | | app/views/comments/ | Views of the controller are stored here | -| test/functional/comments_controller_test.rb | The test for the controller | +| test/controllers/comments_controller_test.rb | The test for the controller | | app/helpers/comments_helper.rb | A view helper file | -| test/unit/helpers/comments_helper_test.rb | The test for the helper | +| test/helpers/comments_helper_test.rb | The test for the helper | | app/assets/javascripts/comment.js.coffee | CoffeeScript for the controller | | app/assets/stylesheets/comment.css.scss | Cascading style sheet for the controller | From d34fd9fd826fb658cb348eacf8b9edfce06f2b3d Mon Sep 17 00:00:00 2001 From: Caleb Wright Date: Sun, 25 Nov 2012 23:46:11 -0500 Subject: [PATCH 11/42] Update guides/source/active_record_validations_callbacks.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the expiration_date_cannot_be_in_the_past validation method, use `expiration_date.present?` instead of the double negative `!expiration_date.blank?`. Also join the comparisons with `&&` instead of `and`, which could cause unintended consequences. --- guides/source/active_record_validations_callbacks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 0f4140b650..28f693a856 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -674,7 +674,7 @@ class Invoice < ActiveRecord::Base :discount_cannot_be_greater_than_total_value def expiration_date_cannot_be_in_the_past - if !expiration_date.blank? and expiration_date < Date.today + if expiration_date.present? && expiration_date < Date.today errors.add(:expiration_date, "can't be in the past") end end From 8f43c9afc47773127d6d74d5fd4ad4a26af98ecf Mon Sep 17 00:00:00 2001 From: Hendy Tanata Date: Tue, 27 Nov 2012 15:46:18 +0800 Subject: [PATCH 12/42] Set fixed-width style where appropriate on Getting Started guide. --- guides/source/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 78af810af9..6d837538d6 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -704,7 +704,7 @@ Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another. Rails includes methods to help you secure some of your model fields. The Rails -model generator added the attr_accessible line to your model file. This change +model generator added the `attr_accessible` line to your model file. This change will ensure that all changes made through HTML forms can edit the content of the text and title fields. Accessible attributes and the mass assignment problem is covered in details in the [Security guide](security.html#mass-assignment) @@ -1286,7 +1286,7 @@ this way: * One post can have many comments. In fact, this is very close to the syntax that Rails uses to declare this -association. You've already seen the line of code inside the Comment model that +association. You've already seen the line of code inside the `Comment` model that makes each comment belong to a Post: ```ruby From ba2fed41613e02bb6cfc46c92ace00abb99ce313 Mon Sep 17 00:00:00 2001 From: Harper Henn Date: Tue, 27 Nov 2012 08:24:25 -0500 Subject: [PATCH 13/42] correct css selector for the display of validation error messages: changed #error_explanation to #errorExplanation --- guides/source/active_record_validations_callbacks.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 28f693a856..eedcd9a342 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -931,10 +931,10 @@ If you pass `nil` in any of these options, the corresponding section of the `div The selectors used to customize the style of error messages are: * `.field_with_errors` - Style for the form fields and labels with errors. -* `#error_explanation` - Style for the `div` element with the error messages. -* `#error_explanation h2` - Style for the header of the `div` element. -* `#error_explanation p` - Style for the paragraph holding the message that appears right below the header of the `div` element. -* `#error_explanation ul li` - Style for the list items with individual error messages. +* `#errorExplanation` - Style for the `div` element with the error messages. +* `#errorExplanation h2` - Style for the header of the `div` element. +* `#errorExplanation p` - Style for the paragraph holding the message that appears right below the header of the `div` element. +* `#errorExplanation ul li` - Style for the list items with individual error messages. If scaffolding was used, file `app/assets/stylesheets/scaffolds.css.scss` will have been generated automatically. This file defines the red-based styles you saw in the examples above. From cfd324b4b68469ba3188e4b7ba8586e59b239693 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 27 Nov 2012 08:51:36 -0800 Subject: [PATCH 14/42] Fix validation based on object not _id. From https://github.com/rails/rails/issues/6161\#issuecomment-10750118 --- guides/source/active_record_validations_callbacks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index eedcd9a342..3c6e459453 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -372,12 +372,12 @@ class Person < ActiveRecord::Base end ``` -If you want to be sure that an association is present, you'll need to test whether the foreign key used to map the association is present, and not the associated object itself. +If you want to be sure that an association is present, you'll need to test the associated object itself, and not whether the foreign key used to map the association is present: ```ruby class LineItem < ActiveRecord::Base belongs_to :order - validates :order_id, presence: true + validates :order, presence: true end ``` From 1ce99553d0dc7c84a9cade9faec8993de0ac6d88 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 27 Nov 2012 08:56:45 -0800 Subject: [PATCH 15/42] Adding a note about :inverse_of for validations. From https://github.com/lifo/docrails/commit/cfd324b4b68469ba3188e4b7ba8586e59b239693\#commitcomment-2213592 --- guides/source/active_record_validations_callbacks.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 3c6e459453..6f1c0b6c24 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -381,6 +381,14 @@ class LineItem < ActiveRecord::Base end ``` +You should also be sure to have a proper `:inverse_of` as well: + +```ruby +class Order < ActiveRecord::Base + has_many :line_items, inverse_of: :order +end +``` + If you validate the presence of an object associated via a `has_one` or `has_many` relationship, it will check that the object is neither `blank?` nor `marked_for_destruction?`. Since `false.blank?` is true, if you want to validate the presence of a boolean field you should use `validates :field_name, inclusion: { in: [true, false] }`. From fdb41cba87064cc91e84ef7e5c5c0ec32cf670c4 Mon Sep 17 00:00:00 2001 From: Andy Lindeman Date: Tue, 27 Nov 2012 22:30:47 -0500 Subject: [PATCH 16/42] Clarifies the cookie store docs a bit and uses correct Markdown syntax for preformatted text --- guides/source/upgrading_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index bf81776006..22cda7a8df 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -69,7 +69,7 @@ in the `config/initializers/wrap_parameters.rb` file: ### Action Pack -There is an upgrading cookie store UpgradeSignatureToEncryptionCookieStore which helps you upgrading apps that use +CookieStore+ to the new default +EncryptedCookieStore+. To use this CookieStore set Myapp::Application.config.session_store :upgrade_signature_to_encryption_cookie_store, key: '_myapp_session' in your config/initializers/session_store.rb. You will also need to add Myapp::Application.config.secret_key_base = 'some secret' in your config/initializers/secret_token.rb, but do not remove +Myapp::Application.config.secret_token = 'some secret'+ +There is an upgrading cookie store `UpgradeSignatureToEncryptionCookieStore` which helps you upgrading apps that use `CookieStore` to the new default `EncryptedCookieStore`. To use this CookieStore set `Myapp::Application.config.session_store :upgrade_signature_to_encryption_cookie_store, key: '_myapp_session'` in `config/initializers/session_store.rb`. Additionally, add `Myapp::Application.config.secret_key_base = 'some secret'` in config/initializers/secret_token.rb (use `rake secret` to generate a value). Do not remove `Myapp::Application.config.secret_token = 'some secret'`. Rails 4.0 removed the `ActionController::Base.asset_path` option. Use the assets pipeline feature. From 6880b30a591913b0b3221f3ed4e52e2b515bf3f6 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Wed, 28 Nov 2012 09:21:17 +0100 Subject: [PATCH 17/42] Revert "correct css selector for the display of validation error messages: changed #error_explanation to #errorExplanation" At least in master the selector is snake case. This reverts commit ba2fed41613e02bb6cfc46c92ace00abb99ce313. --- guides/source/active_record_validations_callbacks.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 6f1c0b6c24..6fb274f104 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -939,10 +939,10 @@ If you pass `nil` in any of these options, the corresponding section of the `div The selectors used to customize the style of error messages are: * `.field_with_errors` - Style for the form fields and labels with errors. -* `#errorExplanation` - Style for the `div` element with the error messages. -* `#errorExplanation h2` - Style for the header of the `div` element. -* `#errorExplanation p` - Style for the paragraph holding the message that appears right below the header of the `div` element. -* `#errorExplanation ul li` - Style for the list items with individual error messages. +* `#error_explanation` - Style for the `div` element with the error messages. +* `#error_explanation h2` - Style for the header of the `div` element. +* `#error_explanation p` - Style for the paragraph holding the message that appears right below the header of the `div` element. +* `#error_explanation ul li` - Style for the list items with individual error messages. If scaffolding was used, file `app/assets/stylesheets/scaffolds.css.scss` will have been generated automatically. This file defines the red-based styles you saw in the examples above. From 213f034059ff6d3227449fa5674fef9ad04742a0 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 03:53:58 -0800 Subject: [PATCH 18/42] Getting Started: Rails 3.2 -> Rails 4. This is based on Rails 4, not Rails 3.2. --- guides/source/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 6d837538d6..4d3d5125a7 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -12,7 +12,7 @@ you should be familiar with: -------------------------------------------------------------------------------- -WARNING. This Guide is based on Rails 3.2. Some of the code shown here will not +WARNING. This Guide is based on Rails 4. Some of the code shown here will not work in earlier versions of Rails. Guide Assumptions From 8bc945da5f23e2961eab633c4e8beb6b078b043f Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 03:57:53 -0800 Subject: [PATCH 19/42] Getting Started: mac -> Mac OS X It's properly called "Mac OS X" --- guides/source/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 4d3d5125a7..e4e65d99d2 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -165,7 +165,7 @@ This will fire up WEBrick, a webserver built into Ruby by default. To see your a ![Welcome Aboard screenshot](images/rails_welcome.png) -TIP: To stop the web server, hit Ctrl+C in the terminal window where it's running. To verify the server has stopped you should see your command prompt cursor again. For most unix like systems including mac this will be a dollar sign `$`. In development mode, Rails does not generally require you to restart the server; changes you make in files will be automatically picked up by the server. +TIP: To stop the web server, hit Ctrl+C in the terminal window where it's running. To verify the server has stopped you should see your command prompt cursor again. For most UNIX-like systems including Mac OS X this will be a dollar sign `$`. In development mode, Rails does not generally require you to restart the server; changes you make in files will be automatically picked up by the server. The "Welcome Aboard" page is the _smoke test_ for a new Rails application: it makes sure that you have your software configured correctly enough to serve a page. You can also click on the _About your application’s environment_ link to see a summary of your application's environment. From e8b26258d0365d57f51eb81b7162fe576da5f6da Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:02:51 -0800 Subject: [PATCH 20/42] Getting Started: remove reference to attr_accessible --- guides/source/getting_started.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index e4e65d99d2..d181bed424 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -693,7 +693,6 @@ The model file, `app/models/post.rb` is about as simple as it can get: ```ruby class Post < ActiveRecord::Base - attr_accessible :text, :title end ``` @@ -703,12 +702,6 @@ your Rails models for free, including basic database CRUD (Create, Read, Update, Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another. -Rails includes methods to help you secure some of your model fields. The Rails -model generator added the `attr_accessible` line to your model file. This change -will ensure that all changes made through HTML forms can edit the content of -the text and title fields. Accessible attributes and the mass assignment problem is covered in -details in the [Security guide](security.html#mass-assignment) - ### Adding Some Validation Rails includes methods to help you validate the data that you send to models. @@ -716,8 +709,6 @@ Open the `app/models/post.rb` file and edit it: ```ruby class Post < ActiveRecord::Base - attr_accessible :text, :title - validates :title, presence: true, length: { minimum: 5 } end @@ -1229,7 +1220,6 @@ First, take a look at `comment.rb`: ```ruby class Comment < ActiveRecord::Base belongs_to :post - attr_accessible :body, :commenter end ``` @@ -1292,7 +1282,6 @@ makes each comment belong to a Post: ```ruby class Comment < ActiveRecord::Base belongs_to :post - attr_accessible :body, :commenter end ``` From 28e8abfa59341377a6568413dfc207ce1e1c7909 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:10:03 -0800 Subject: [PATCH 21/42] Getting Started: Improve instructions on opening a terminal --- guides/source/getting_started.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index d181bed424..2048cb49d8 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -77,7 +77,10 @@ TIP: The examples below use # and $ to denote superuser and regular user termina ### Installing Rails -Open up a command line prompt. On a mac this is called terminal, on windows it is called command prompt. Any commands prefaced with a dollar sign `$` should be run in the command line. Verify sure you have a current version of Ruby installed: +Open up a command line prompt. On Mac OS X open Terminal.app, on Windows choose +"Run" from your Start menu and type 'cmd.exe'. Any commands prefaced with a +dollar sign `$` should be run in the command line. Verify sure you have a +current version of Ruby installed: ```bash $ ruby -v From 0c294e0010810e3d9a4bcfa72ab96ff2af0240a6 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:27:29 -0800 Subject: [PATCH 22/42] Migrations: move massive paragraph out of intro. Most of the guides have a few simple sentences describing what they will show you at the top. This one had a few big paragraphs. I've moved those paragraphs down to an introductory one, and written a new smaller one for the introduction. This makes this guide more consistent with the others. --- guides/source/migrations.md | 41 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/guides/source/migrations.md b/guides/source/migrations.md index a1131f1f79..d8a7eb3abc 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -1,22 +1,10 @@ Migrations ========== -Migrations are a convenient way for you to alter your database in a structured -and organized manner. You could edit fragments of SQL by hand but you would then -be responsible for telling other developers that they need to go and run them. -You'd also have to keep track of which changes need to be run against the -production machines next time you deploy. - -Active Record tracks which migrations have already been run so all you have to -do is update your source and run `rake db:migrate`. Active Record will work out -which migrations should be run. Active Record will also update your `db/schema.rb` file to match the up-to-date structure of your database. - -Migrations also allow you to describe these transformations using Ruby. The -great thing about this is that (like most of Active Record's functionality) it -is database independent: you don't need to worry about the precise syntax of -`CREATE TABLE` any more than you worry about variations on `SELECT *` (you can -drop down to raw SQL for database specific features). For example, you could use -SQLite3 in development, but MySQL in production. +Migrations are a feature of Active Record that allows you to evolve your +database schema over time. Rather than write schema modifications in pure SQL, +migrations allow you to use an easy Ruby DSL to describe changes to your +tables. In this guide, you'll learn all about migrations including: @@ -27,6 +15,27 @@ In this guide, you'll learn all about migrations including: -------------------------------------------------------------------------------- +What are Migrations? +-------------------- + +Migrations are a convenient way for you to alter your database in a structured +and organized manner. You could edit fragments of SQL by hand but you would then +be responsible for telling other developers that they need to go and run them. +You'd also have to keep track of which changes need to be run against the +production machines next time you deploy. + +Active Record tracks which migrations have already been run so all you have to +do is update your source and run `rake db:migrate`. Active Record will work out +which migrations should be run. Active Record will also update your +`db/schema.rb` file to match the up-to-date structure of your database. + +Migrations also allow you to describe these transformations using Ruby. The +great thing about this is that (like most of Active Record's functionality) it +is database independent: you don't need to worry about the precise syntax of +`CREATE TABLE` any more than you worry about variations on `SELECT *` (you can +drop down to raw SQL for database specific features). For example, you could use +SQLite3 in development, but MySQL in production. + Anatomy of a Migration ---------------------- From 27138386ad8dbda2eb44e622515626f352fd3b22 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:35:13 -0800 Subject: [PATCH 23/42] ActiveRecord -> Active Record The proper name, as per the documentation guides, is 'Active Record.' I've updated several references to it as 'ActiveRecord'. --- guides/source/active_model_basics.md | 2 +- guides/source/active_record_querying.md | 2 +- guides/source/active_support_instrumentation.md | 2 +- guides/source/testing.md | 4 ++-- guides/source/upgrading_ruby_on_rails.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md index 92b51334a3..0613c14d94 100644 --- a/guides/source/active_model_basics.md +++ b/guides/source/active_model_basics.md @@ -1,7 +1,7 @@ Active Model Basics =================== -This guide should provide you with all you need to get started using model classes. Active Model allows for Action Pack helpers to interact with non-ActiveRecord models. Active Model also helps building custom ORMs for use outside of the Rails framework. +This guide should provide you with all you need to get started using model classes. Active Model allows for Action Pack helpers to interact with non-Active Record models. Active Model also helps building custom ORMs for use outside of the Rails framework. -------------------------------------------------------------------------------- diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 32c139df99..3616257c77 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -466,7 +466,7 @@ The field name can also be a string: Client.where('locked' => true) ``` -In the case of a belongs_to relationship, an association key can be used to specify the model if an ActiveRecord object is used as the value. This method works with polymorphic relationships as well. +In the case of a belongs_to relationship, an association key can be used to specify the model if an Active Record object is used as the value. This method works with polymorphic relationships as well. ```ruby Post.where(author: author) diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 1163940f10..46fb2f7d6a 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -216,7 +216,7 @@ ActionView } ``` -ActiveRecord +Active Record ------------ ### sql.active_record diff --git a/guides/source/testing.md b/guides/source/testing.md index f898456d39..f05444ddde 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -97,9 +97,9 @@ Rails by default automatically loads all fixtures from the `test/fixtures` folde * Load the fixture data into the table * Dump the fixture data into a variable in case you want to access it directly -#### Fixtures are ActiveRecord objects +#### Fixtures are Active Record objects -Fixtures are instances of ActiveRecord. As mentioned in point #3 above, you can access the object directly because it is automatically setup as a local variable of the test case. For example: +Fixtures are instances of Active Record. As mentioned in point #3 above, you can access the object directly because it is automatically setup as a local variable of the test case. For example: ```ruby # this will return the User object for the fixture named david diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 22cda7a8df..9838e02d1a 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -45,7 +45,7 @@ Rails 4.0 has removed the identity map from Active Record, due to [some inconsis The `delete` method in collection associations can now receive `Fixnum` or `String` arguments as record ids, besides records, pretty much like the `destroy` method does. Previously it raised `ActiveRecord::AssociationTypeMismatch` for such arguments. From Rails 4.0 on `delete` automatically tries to find the records matching the given ids before deleting them. -Rails 4.0 has changed how orders get stacked in `ActiveRecord::Relation`. In previous versions of rails new order was applied after previous defined order. But this is no long true. Check [ActiveRecord Query guide](active_record_querying.html#ordering) for more information. +Rails 4.0 has changed how orders get stacked in `ActiveRecord::Relation`. In previous versions of rails new order was applied after previous defined order. But this is no long true. Check [Active Record Query guide](active_record_querying.html#ordering) for more information. Rails 4.0 has changed `serialized_attributes` and `attr_readonly` to class methods only. Now you shouldn't use instance methods, it's deprecated. You must change them, e.g. `self.serialized_attributes` to `self.class.serialized_attributes`. From 4d1053f395b0c2eef711d34d02ca3ac3cfb3ebf0 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:36:22 -0800 Subject: [PATCH 24/42] ActionPack -> Action Pack. The proper name has a space. --- guides/source/upgrading_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 9838e02d1a..295b5148ae 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -76,7 +76,7 @@ Rails 4.0 removed the `ActionController::Base.asset_path` option. Use the assets Rails 4.0 has deprecated `ActionController::Base.page_cache_extension` option. Use `ActionController::Base.default_static_extension` instead. -Rails 4.0 has removed Action and Page caching from ActionPack. You will need to +Rails 4.0 has removed Action and Page caching from Action Pack. You will need to add the `actionpack-action_caching` gem in order to use `caches_action` and the `actionpack-page_caching` to use `caches_pages` in your controllers. From 0dfe2c21f1b7cfefa67a190ccbf7f8393f91a551 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:37:40 -0800 Subject: [PATCH 25/42] ActionMailer -> Action Mailer. The proper name for the library has a space. --- guides/source/active_support_instrumentation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 46fb2f7d6a..f67edefd86 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -246,8 +246,8 @@ INFO. The adapters will add their own data as well. | `:name` | Record's class | | `:connection_id` | `self.object_id` | -ActionMailer ------------- +Action Mailer +------------- ### receive.action_mailer From 4e538bc8d6861b4a18799743a36dbde1a6690ea6 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:40:34 -0800 Subject: [PATCH 26/42] ActiveSupport -> Active Support The proper name has a space. --- guides/source/active_support_instrumentation.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index f67edefd86..5c3f4dce2d 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -3,7 +3,7 @@ Active Support Instrumentation Active Support is a part of core Rails that provides Ruby language extensions, utilities and other things. One of the things it includes is an instrumentation API that can be used inside an application to measure certain actions that occur within Ruby code, such as that inside a Rails application or the framework itself. It is not limited to Rails, however. It can be used independently in other Ruby scripts if it is so desired. -In this guide, you will learn how to use the instrumentation API inside of ActiveSupport to measure events inside of Rails and other Ruby code. We cover: +In this guide, you will learn how to use the instrumentation API inside of Active Support to measure events inside of Rails and other Ruby code. We cover: * What instrumentation can provide * The hooks inside the Rails framework for instrumentation @@ -15,7 +15,7 @@ In this guide, you will learn how to use the instrumentation API inside of Activ Introduction to instrumentation ------------------------------- -The instrumentation API provided by ActiveSupport allows developers to provide hooks which other developers may hook into. There are several of these within the Rails framework, as described below in . With this API, developers can choose to be notified when certain events occur inside their application or another piece of Ruby code. +The instrumentation API provided by Active Support allows developers to provide hooks which other developers may hook into. There are several of these within the Rails framework, as described below in . With this API, developers can choose to be notified when certain events occur inside their application or another piece of Ruby code. For example, there is a hook provided within Active Record that is called every time Active Record uses an SQL query on a database. This hook could be **subscribed** to, and used to track the number of queries during a certain action. There's another hook around the processing of an action of a controller. This could be used, for instance, to track how long a specific action has taken. @@ -312,8 +312,8 @@ ActiveResource | `:request_uri` | Complete URI | | `:result` | HTTP response object | -ActiveSupport -------------- +Active Support +-------------- ### cache_read.active_support From 43806394c483e31dd7e827ce621c91a8f76e2611 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:42:25 -0800 Subject: [PATCH 27/42] ActionController -> Action Controller The proper name has a space. --- guides/source/active_support_instrumentation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 5c3f4dce2d..cb0d13f959 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -26,8 +26,8 @@ Rails framework hooks Within the Ruby on Rails framework, there are a number of hooks provided for common events. These are detailed below. -ActionController ----------------- +Action Controller +----------------- ### write_fragment.action_controller From c0f415d279fba327b5ea682b3128f19a4275dd71 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 04:44:31 -0800 Subject: [PATCH 28/42] ActionView -> Action View The proper name has a space. --- guides/source/active_support_instrumentation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index cb0d13f959..aa08b0f055 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -187,8 +187,8 @@ INFO. Additional keys may be added by the caller. } ``` -ActionView ----------- +Action View +----------- ### render_template.action_view From 5cdb23c722dbec0a4a5f74f2b64250bf410db5e2 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:07:53 -0800 Subject: [PATCH 29/42] Migrations: Fix opening bullets. The wording of these was a bit off, so I fixed them. --- guides/source/migrations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/migrations.md b/guides/source/migrations.md index d8a7eb3abc..8ed0931689 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -10,8 +10,8 @@ In this guide, you'll learn all about migrations including: * The generators you can use to create them * The methods Active Record provides to manipulate your database -* The Rake tasks that manipulate them -* How they relate to `schema.rb` +* The Rake tasks that manipulate migrations and your schema +* How migrations relate to `schema.rb` -------------------------------------------------------------------------------- From 6dcae8ae9c21abd95cc119dd5625b4fb44fd4350 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:14:08 -0800 Subject: [PATCH 30/42] Add periods to the bullet points in guides. Talked with @fxn about this. Bullet points should have periods at the ends. --- guides/source/action_controller_overview.md | 14 +++++++------- guides/source/action_view_overview.md | 10 +++++----- guides/source/active_record_basics.md | 10 +++++----- guides/source/active_record_querying.md | 14 +++++++------- .../source/active_record_validations_callbacks.md | 14 +++++++------- guides/source/active_support_instrumentation.md | 8 ++++---- guides/source/asset_pipeline.md | 10 +++++----- guides/source/association_basics.md | 6 +++--- guides/source/caching_with_rails.md | 8 ++++---- guides/source/command_line.md | 10 +++++----- guides/source/configuring.md | 4 ++-- guides/source/contributing_to_ruby_on_rails.md | 10 +++++----- guides/source/debugging_rails_applications.md | 8 ++++---- guides/source/engines.md | 10 +++++----- guides/source/form_helpers.md | 14 +++++++------- guides/source/generators.md | 14 +++++++------- guides/source/i18n.md | 8 ++++---- guides/source/initialization.md | 2 +- guides/source/layouts_and_rendering.md | 8 ++++---- guides/source/migrations.md | 8 ++++---- guides/source/nested_model_forms.md | 2 +- guides/source/plugins.md | 8 ++++---- guides/source/rails_application_templates.md | 4 ++-- guides/source/rails_on_rack.md | 8 ++++---- guides/source/routing.md | 10 +++++----- guides/source/security.md | 14 +++++++------- guides/source/testing.md | 6 +++--- guides/source/working_with_javascript_in_rails.md | 10 +++++----- 28 files changed, 126 insertions(+), 126 deletions(-) diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 6f161e83ea..267ca865c8 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -3,13 +3,13 @@ Action Controller Overview In this guide you will learn how controllers work and how they fit into the request cycle in your application. After reading this guide, you will be able to: -* Follow the flow of a request through a controller -* Understand why and how to store data in the session or cookies -* Work with filters to execute code during request processing -* Use Action Controller's built-in HTTP authentication -* Stream data directly to the user's browser -* Filter sensitive parameters so they do not appear in the application's log -* Deal with exceptions that may be raised during request processing +* Follow the flow of a request through a controller. +* Understand why and how to store data in the session or cookies. +* Work with filters to execute code during request processing. +* Use Action Controller's built-in HTTP authentication. +* Stream data directly to the user's browser. +* Filter sensitive parameters so they do not appear in the application's log. +* Deal with exceptions that may be raised during request processing. -------------------------------------------------------------------------------- diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md index 2625e237bf..648d4ace2c 100644 --- a/guides/source/action_view_overview.md +++ b/guides/source/action_view_overview.md @@ -3,11 +3,11 @@ Action View Overview In this guide you will learn: -* What Action View is and how to use it with Rails -* How best to use templates, partials, and layouts -* What helpers are provided by Action View and how to make your own -* How to use localized views -* How to use Action View outside of Rails +* What Action View is and how to use it with Rails. +* How best to use templates, partials, and layouts. +* What helpers are provided by Action View and how to make your own. +* How to use localized views. +* How to use Action View outside of Rails. -------------------------------------------------------------------------------- diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md index 810a0263c0..a5c088dde4 100644 --- a/guides/source/active_record_basics.md +++ b/guides/source/active_record_basics.md @@ -3,11 +3,11 @@ Active Record Basics This guide is an introduction to Active Record. After reading this guide we hope that you'll learn: -* What Object Relational Mapping and Active Record are and how they are used in Rails -* How Active Record fits into the Model-View-Controller paradigm -* How to use Active Record models to manipulate data stored in a relational database -* Active Record schema naming conventions -* The concepts of database migrations, validations and callbacks +* What Object Relational Mapping and Active Record are and how they are used in Rails. +* How Active Record fits into the Model-View-Controller paradigm. +* How to use Active Record models to manipulate data stored in a relational database. +* Active Record schema naming conventions. +* The concepts of database migrations, validations and callbacks. -------------------------------------------------------------------------------- diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 3616257c77..3fc6d3e2c6 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -3,13 +3,13 @@ Active Record Query Interface This guide covers different ways to retrieve data from the database using Active Record. By referring to this guide, you will be able to: -* Find records using a variety of methods and conditions -* Specify the order, retrieved attributes, grouping, and other properties of the found records -* Use eager loading to reduce the number of database queries needed for data retrieval -* Use dynamic finders methods -* Check for the existence of particular records -* Perform various calculations on Active Record models -* Run EXPLAIN on relations +* Find records using a variety of methods and conditions. +* Specify the order, retrieved attributes, grouping, and other properties of the found records. +* Use eager loading to reduce the number of database queries needed for data retrieval. +* Use dynamic finders methods. +* Check for the existence of particular records. +* Perform various calculations on Active Record models. +* Run EXPLAIN on relations. -------------------------------------------------------------------------------- diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 6fb274f104..fb3b609342 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -5,13 +5,13 @@ This guide teaches you how to hook into the life cycle of your Active Record obj After reading this guide and trying out the presented concepts, we hope that you'll be able to: -* Understand the life cycle of Active Record objects -* Use the built-in Active Record validation helpers -* Create your own custom validation methods -* Work with the error messages generated by the validation process -* Create callback methods that respond to events in the object life cycle -* Create special classes that encapsulate common behavior for your callbacks -* Create Observers that respond to life cycle events outside of the original class +* Understand the life cycle of Active Record objects. +* Use the built-in Active Record validation helpers. +* Create your own custom validation methods. +* Work with the error messages generated by the validation process. +* Create callback methods that respond to events in the object life cycle. +* Create special classes that encapsulate common behavior for your callbacks. +* Create Observers that respond to life cycle events outside of the original class. -------------------------------------------------------------------------------- diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index aa08b0f055..fd3a179726 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -5,10 +5,10 @@ Active Support is a part of core Rails that provides Ruby language extensions, u In this guide, you will learn how to use the instrumentation API inside of Active Support to measure events inside of Rails and other Ruby code. We cover: -* What instrumentation can provide -* The hooks inside the Rails framework for instrumentation -* Adding a subscriber to a hook -* Building a custom instrumentation implementation +* What instrumentation can provide. +* The hooks inside the Rails framework for instrumentation. +* Adding a subscriber to a hook. +* Building a custom instrumentation implementation. -------------------------------------------------------------------------------- diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 13df1965b6..8ab11888f5 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -4,11 +4,11 @@ Asset Pipeline This guide covers the asset pipeline introduced in Rails 3.1. By referring to this guide you will be able to: -* Understand what the asset pipeline is and what it does -* Properly organize your application assets -* Understand the benefits of the asset pipeline -* Add a pre-processor to the pipeline -* Package assets with a gem +* Understand what the asset pipeline is and what it does. +* Properly organize your application assets. +* Understand the benefits of the asset pipeline. +* Add a pre-processor to the pipeline. +* Package assets with a gem. -------------------------------------------------------------------------------- diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 9bb5aa8bc2..dcba0d38ae 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -3,9 +3,9 @@ A Guide to Active Record Associations This guide covers the association features of Active Record. By referring to this guide, you will be able to: -* Declare associations between Active Record models -* Understand the various types of Active Record associations -* Use the methods added to your models by creating associations +* Declare associations between Active Record models. +* Understand the various types of Active Record associations. +* Use the methods added to your models by creating associations. -------------------------------------------------------------------------------- diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index 826ddd264a..0e9e382fcb 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -5,10 +5,10 @@ This guide will teach you what you need to know about avoiding that expensive ro After reading this guide, you should be able to use and configure: -* Page, action, and fragment caching -* Sweepers -* Alternative cache stores -* Conditional GET support +* Page, action, and fragment caching. +* Sweepers. +* Alternative cache stores. +* Conditional GET support. -------------------------------------------------------------------------------- diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 9521212581..3e91106602 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -3,11 +3,11 @@ A Guide to The Rails Command Line Rails comes with every command line tool you'll need to -* Create a Rails application -* Generate models, controllers, database migrations, and unit tests -* Start a development server -* Experiment with objects through an interactive shell -* Profile and benchmark your new creation +* Create a Rails application. +* Generate models, controllers, database migrations, and unit tests. +* Start a development server. +* Experiment with objects through an interactive shell. +* Profile and benchmark your new creation. -------------------------------------------------------------------------------- diff --git a/guides/source/configuring.md b/guides/source/configuring.md index ac763d6e0e..63a6dae5bb 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -3,8 +3,8 @@ Configuring Rails Applications This guide covers the configuration and initialization features available to Rails applications. By referring to this guide, you will be able to: -* Adjust the behavior of your Rails applications -* Add additional code to be run at application start time +* Adjust the behavior of your Rails applications. +* Add additional code to be run at application start time. -------------------------------------------------------------------------------- diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index feb32eb06f..68e27a6e8f 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -3,11 +3,11 @@ Contributing to Ruby on Rails This guide covers ways in which _you_ can become a part of the ongoing development of Ruby on Rails. After reading it, you should be familiar with: -* Using GitHub to report issues -* Cloning master and running the test suite -* Helping to resolve existing issues -* Contributing to the Ruby on Rails documentation -* Contributing to the Ruby on Rails code +* Using GitHub to report issues. +* Cloning master and running the test suite. +* Helping to resolve existing issues. +* Contributing to the Ruby on Rails documentation. +* Contributing to the Ruby on Rails code. Ruby on Rails is not "someone else's framework." Over the years, hundreds of people have contributed to Ruby on Rails ranging from a single character to massive architectural changes or significant documentation — all with the goal of making Ruby on Rails better for everyone. Even if you don't feel up to writing code or documentation yet, there are a variety of other ways that you can contribute, from reporting issues to testing patches. diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md index d4415d9b76..7b21cac50e 100644 --- a/guides/source/debugging_rails_applications.md +++ b/guides/source/debugging_rails_applications.md @@ -3,10 +3,10 @@ Debugging Rails Applications This guide introduces techniques for debugging Ruby on Rails applications. By referring to this guide, you will be able to: -* Understand the purpose of debugging -* Track down problems and issues in your application that your tests aren't identifying -* Learn the different ways of debugging -* Analyze the stack trace +* Understand the purpose of debugging. +* Track down problems and issues in your application that your tests aren't identifying. +* Learn the different ways of debugging. +* Analyze the stack trace. -------------------------------------------------------------------------------- diff --git a/guides/source/engines.md b/guides/source/engines.md index d8f5796dde..7d0b0dd964 100644 --- a/guides/source/engines.md +++ b/guides/source/engines.md @@ -3,11 +3,11 @@ Getting Started with Engines In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface. You will learn the following things in this guide: -* What makes an engine -* How to generate an engine -* Building features for the engine -* Hooking the engine into an application -* Overriding engine functionality in the application +* What makes an engine. +* How to generate an engine. +* Building features for the engine. +* Hooking the engine into an application. +* Overriding engine functionality in the application. -------------------------------------------------------------------------------- diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index fc317d4773..b1917c2a36 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -5,13 +5,13 @@ Forms in web applications are an essential interface for user input. However, fo In this guide you will: -* Create search forms and similar kind of generic forms not representing any specific model in your application -* Make model-centric forms for creation and editing of specific database records -* Generate select boxes from multiple types of data -* Understand the date and time helpers Rails provides -* Learn what makes a file upload form different -* Learn some cases of building forms to external resources -* Find out how to build complex forms +* Create search forms and similar kind of generic forms not representing any specific model in your application. +* Make model-centric forms for creation and editing of specific database records. +* Generate select boxes from multiple types of data. +* Understand the date and time helpers Rails provides. +* Learn what makes a file upload form different. +* Learn some cases of building forms to external resources. +* Find out how to build complex forms. -------------------------------------------------------------------------------- diff --git a/guides/source/generators.md b/guides/source/generators.md index d1ba19e078..f4698ab6fd 100644 --- a/guides/source/generators.md +++ b/guides/source/generators.md @@ -5,13 +5,13 @@ Rails generators are an essential tool if you plan to improve your workflow. Wit In this guide you will: -* Learn how to see which generators are available in your application -* Create a generator using templates -* Learn how Rails searches for generators before invoking them -* Customize your scaffold by creating new generators -* Customize your scaffold by changing generator templates -* Learn how to use fallbacks to avoid overwriting a huge set of generators -* Learn how to create an application template +* Learn how to see which generators are available in your application. +* Create a generator using templates. +* Learn how Rails searches for generators before invoking them. +* Customize your scaffold by creating new generators. +* Customize your scaffold by changing generator templates. +* Learn how to use fallbacks to avoid overwriting a huge set of generators. +* Learn how to create an application template. -------------------------------------------------------------------------------- diff --git a/guides/source/i18n.md b/guides/source/i18n.md index 5ffd955f66..c07d24fbe5 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -7,15 +7,15 @@ The process of "internationalization" usually means to abstract all strings and So, in the process of _internationalizing_ your Rails application you have to: -* Ensure you have support for i18n -* Tell Rails where to find locale dictionaries -* Tell Rails how to set, preserve and switch locales +* Ensure you have support for i18n. +* Tell Rails where to find locale dictionaries. +* Tell Rails how to set, preserve and switch locales. In the process of _localizing_ your application you'll probably want to do the following three things: * Replace or supplement Rails' default locale — e.g. date and time formats, month names, Active Record model names, etc. * Abstract strings in your application into keyed dictionaries — e.g. flash messages, static text in your views, etc. -* Store the resulting dictionaries somewhere +* Store the resulting dictionaries somewhere. This guide will walk you through the I18n API and contains a tutorial on how to internationalize a Rails application from the start. diff --git a/guides/source/initialization.md b/guides/source/initialization.md index 393bf51863..a0aad24ecd 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -4,7 +4,7 @@ The Rails Initialization Process This guide explains the internals of the initialization process in Rails as of Rails 4. It is an extremely in-depth guide and recommended for advanced Rails developers. -* Using `rails server` +* Using `rails server`. -------------------------------------------------------------------------------- diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 141876b5a3..9ed01df590 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -3,10 +3,10 @@ Layouts and Rendering in Rails This guide covers the basic layout features of Action Controller and Action View. By referring to this guide, you will be able to: -* Use the various rendering methods built into Rails -* Create layouts with multiple content sections -* Use partials to DRY up your views -* Use nested layouts (sub-templates) +* Use the various rendering methods built into Rails. +* Create layouts with multiple content sections. +* Use partials to DRY up your views. +* Use nested layouts (sub-templates). -------------------------------------------------------------------------------- diff --git a/guides/source/migrations.md b/guides/source/migrations.md index 8ed0931689..471fcf5663 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -8,10 +8,10 @@ tables. In this guide, you'll learn all about migrations including: -* The generators you can use to create them -* The methods Active Record provides to manipulate your database -* The Rake tasks that manipulate migrations and your schema -* How migrations relate to `schema.rb` +* The generators you can use to create them. +* The methods Active Record provides to manipulate your database. +* The Rake tasks that manipulate migrations and your schema. +* How migrations relate to `schema.rb`. -------------------------------------------------------------------------------- diff --git a/guides/source/nested_model_forms.md b/guides/source/nested_model_forms.md index b5f112e6c9..49cb451947 100644 --- a/guides/source/nested_model_forms.md +++ b/guides/source/nested_model_forms.md @@ -5,7 +5,7 @@ Creating a form for a model _and_ its associations can become quite tedious. The In this guide you will: -* do stuff +* do stuff. -------------------------------------------------------------------------------- diff --git a/guides/source/plugins.md b/guides/source/plugins.md index c657281741..66f4551355 100644 --- a/guides/source/plugins.md +++ b/guides/source/plugins.md @@ -9,13 +9,13 @@ A Rails plugin is either an extension or a modification of the core framework. P After reading this guide you should be familiar with: -* Creating a plugin from scratch -* Writing and running tests for the plugin +* Creating a plugin from scratch. +* Writing and running tests for the plugin. This guide describes how to build a test-driven plugin that will: -* Extend core Ruby classes like Hash and String -* Add methods to ActiveRecord::Base in the tradition of the 'acts_as' plugins +* Extend core Ruby classes like Hash and String. +* Add methods to ActiveRecord::Base in the tradition of the 'acts_as' plugins. * Give you information about where to put generators in your plugin. For the purpose of this guide pretend for a moment that you are an avid bird watcher. diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index 6cd19eb8e9..25ca09de94 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -5,8 +5,8 @@ Application templates are simple Ruby files containing DSL for adding gems/initi By referring to this guide, you will be able to: -* Use templates to generate/customize Rails applications -* Write your own reusable application templates using the Rails template API +* Use templates to generate/customize Rails applications. +* Write your own reusable application templates using the Rails template API. -------------------------------------------------------------------------------- diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md index afd1638ed9..3f7760609c 100644 --- a/guides/source/rails_on_rack.md +++ b/guides/source/rails_on_rack.md @@ -3,10 +3,10 @@ Rails on Rack This guide covers Rails integration with Rack and interfacing with other Rack components. By referring to this guide, you will be able to: -* Create Rails Metal applications -* Use Rack Middlewares in your Rails applications -* Understand Action Pack's internal Middleware stack -* Define a custom Middleware stack +* Create Rails Metal applications. +* Use Rack Middlewares in your Rails applications. +* Understand Action Pack's internal Middleware stack. +* Define a custom Middleware stack. -------------------------------------------------------------------------------- diff --git a/guides/source/routing.md b/guides/source/routing.md index 53f037c25b..69c36aa073 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -3,11 +3,11 @@ Rails Routing from the Outside In This guide covers the user-facing features of Rails routing. By referring to this guide, you will be able to: -* Understand the code in `routes.rb` -* Construct your own routes, using either the preferred resourceful style or the `match` method -* Identify what parameters to expect an action to receive -* Automatically create paths and URLs using route helpers -* Use advanced techniques such as constraints and Rack endpoints +* Understand the code in `routes.rb`. +* Construct your own routes, using either the preferred resourceful style or the `match` method. +* Identify what parameters to expect an action to receive. +* Automatically create paths and URLs using route helpers. +* Use advanced techniques such as constraints and Rack endpoints. -------------------------------------------------------------------------------- diff --git a/guides/source/security.md b/guides/source/security.md index 4902f83f8a..98fc49c8c1 100644 --- a/guides/source/security.md +++ b/guides/source/security.md @@ -3,13 +3,13 @@ Ruby On Rails Security Guide This manual describes common security problems in web applications and how to avoid them with Rails. After reading it, you should be familiar with: -* All countermeasures _that are highlighted_ -* The concept of sessions in Rails, what to put in there and popular attack methods -* How just visiting a site can be a security problem (with CSRF) -* What you have to pay attention to when working with files or providing an administration interface -* The Rails-specific mass assignment problem -* How to manage users: Logging in and out and attack methods on all layers -* And the most popular injection attack methods +* All countermeasures _that are highlighted_. +* The concept of sessions in Rails, what to put in there and popular attack methods. +* How just visiting a site can be a security problem (with CSRF). +* What you have to pay attention to when working with files or providing an administration interface. +* The Rails-specific mass assignment problem. +* How to manage users: Logging in and out and attack methods on all layers. +* And the most popular injection attack methods. -------------------------------------------------------------------------------- diff --git a/guides/source/testing.md b/guides/source/testing.md index f05444ddde..cb6a768759 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -4,9 +4,9 @@ A Guide to Testing Rails Applications This guide covers built-in mechanisms offered by Rails to test your application. By referring to this guide, you will be able to: -* Understand Rails testing terminology -* Write unit, functional, and integration tests for your application -* Identify other popular testing approaches and plugins +* Understand Rails testing terminology. +* Write unit, functional, and integration tests for your application. +* Identify other popular testing approaches and plugins. -------------------------------------------------------------------------------- diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index 10b9dddd02..ec720bd0a2 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -5,11 +5,11 @@ 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 -* Unobtrusive JavaScript -* How Rails' built-in helpers assist you -* Handling Ajax on the server side -* The Turbolinks gem +* Quick introduction to Ajax. +* Unobtrusive JavaScript. +* How Rails' built-in helpers assist you. +* Handling Ajax on the server side. +* The Turbolinks gem. ------------------------------------------------------------------------------- From 5ea8a41cdde71a7ed69340b857b391633e8d04b9 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:21:30 -0800 Subject: [PATCH 31/42] Remove 'This guide is based on ' warnings. It's obvious that the guide is based on this version of Rails, and may not be backwards compatible. --- guides/source/action_mailer_basics.md | 2 -- guides/source/active_model_basics.md | 2 -- guides/source/command_line.md | 2 -- guides/source/getting_started.md | 3 --- 4 files changed, 9 deletions(-) diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index 8687cfea52..ca5a085172 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -5,8 +5,6 @@ This guide should provide you with all you need to get started in sending and re -------------------------------------------------------------------------------- -WARNING. This guide is based on Rails 3.2. Some of the code shown here will not work in earlier versions of Rails. - Introduction ------------ diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md index 0613c14d94..6fecaa32a7 100644 --- a/guides/source/active_model_basics.md +++ b/guides/source/active_model_basics.md @@ -5,8 +5,6 @@ This guide should provide you with all you need to get started using model class -------------------------------------------------------------------------------- -WARNING. This guide is based on Rails 3.0. Some of the code shown here will not work in earlier versions of Rails. - Introduction ------------ diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 3e91106602..1615f0148b 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -13,8 +13,6 @@ Rails comes with every command line tool you'll need to NOTE: This tutorial assumes you have basic Rails knowledge from reading the [Getting Started with Rails Guide](getting_started.html). -WARNING. This Guide is based on Rails 3.2. Some of the code shown here will not work in earlier versions of Rails. - Command Line Basics ------------------- diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 2048cb49d8..bddf5b3d40 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -12,9 +12,6 @@ you should be familiar with: -------------------------------------------------------------------------------- -WARNING. This Guide is based on Rails 4. Some of the code shown here will not -work in earlier versions of Rails. - Guide Assumptions ----------------- From 87b5d53e2f99d87efd8ff1d5e33db6a91dd7771c Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:27:09 -0800 Subject: [PATCH 32/42] Associations: s/A Guide// It's obvious that this is a guide, and none of the other guides say 'A Guide to'. --- guides/source/association_basics.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index dcba0d38ae..2ffbacfebd 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -1,5 +1,5 @@ -A Guide to Active Record Associations -===================================== +Active Record Associations +========================== This guide covers the association features of Active Record. By referring to this guide, you will be able to: From e6b8452e58a4f7d92bce13bef6060ec9fa6f7d60 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:28:52 -0800 Subject: [PATCH 33/42] Fix title of 'form helpers' guide. They're Rails Guides, so obviously we're talking about Rails Form Helpers. Also, 'helpers' should be capitalized. --- guides/source/form_helpers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index b1917c2a36..2ca387db4b 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -1,5 +1,5 @@ -Rails Form helpers -================== +Form Helpers +============ Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of form control naming and their numerous attributes. Rails deals away with these complexities by providing view helpers for generating form markup. However, since they have different use-cases, developers are required to know all the differences between similar helper methods before putting them to use. From 9715d0a30a9df2cf54cb49e6db854fc0c419bdb9 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:30:31 -0800 Subject: [PATCH 34/42] Migrations: add 'Active Record' to title Other guides that talk about Active Record specific features include the name of the library in the title, this one should too for consistency. --- guides/source/migrations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/migrations.md b/guides/source/migrations.md index 471fcf5663..e6d2f6e0a9 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -1,5 +1,5 @@ -Migrations -========== +Active Record Migrations +======================== Migrations are a feature of Active Record that allows you to evolve your database schema over time. Rather than write schema modifications in pure SQL, From 362f28dedabe110233206f0ea02db2c9ca0c945b Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:32:12 -0800 Subject: [PATCH 35/42] Command Line: remove 'A Guide to' It's obvious that this is a guide. --- guides/source/command_line.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 1615f0148b..830de1c2bb 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -1,5 +1,5 @@ -A Guide to The Rails Command Line -================================= +The Rails Command Line +====================== Rails comes with every command line tool you'll need to From 97b95c3efb12d4afe11a73ced18d0b0ad906efdb Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 05:34:00 -0800 Subject: [PATCH 36/42] Asset Pipeline: add 'the' Some guides work without 'the'. For instance, 'Migrations' or 'Form Helpers.' But when we talk about the asset pipeline, we... always say 'the asset pipeline.' The guide title should reflect this. --- guides/source/asset_pipeline.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 8ab11888f5..5bed678327 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -1,5 +1,5 @@ -Asset Pipeline -============== +The Asset Pipeline +================== This guide covers the asset pipeline introduced in Rails 3.1. By referring to this guide you will be able to: From 61a7a9f38bfce21bbeb1dd09efabc4f1002cc00d Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 29 Nov 2012 12:51:31 -0500 Subject: [PATCH 37/42] add documentation to CollectionProxy#empty? --- .../lib/active_record/associations/collection_proxy.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index e444b0ed83..d57fa40b91 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -718,7 +718,12 @@ module ActiveRecord @association.length end - # Returns +true+ if the collection is empty. + # Returns +true+ if the collection is empty. If the collection has been + # loaded or the :counter_sql option is provided, it is equivalent + # to collection.size.zero?. If the collection has not been loaded, + # it is equivalent to collection.exists?. If the collection has + # not already been loaded and you are going to fetch the records anyway it + # is better to check collection.length.zero?. # # class Person < ActiveRecord::Base # has_many :pets From abdfffa2139355d7ccb6d8fd91a6bb21f2f1b8d8 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 29 Nov 2012 12:58:31 -0500 Subject: [PATCH 38/42] add documentation to CollectionProxy #length and #size methods [ci skip] --- .../lib/active_record/associations/collection_proxy.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index d57fa40b91..a9a4eb8728 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -672,7 +672,11 @@ module ActiveRecord end # Returns the size of the collection. If the collection hasn't been loaded, - # it executes a SELECT COUNT(*) query. + # it executes a SELECT COUNT(*) query. If it has, calls collection.size. + # + # If the collection has been already loaded +size+ and +length+ are + # equivalent. If not and you are going to need the records anyway + # +length+ will take one less query. Otherwise +size+ is more efficient. # # class Person < ActiveRecord::Base # has_many :pets @@ -697,7 +701,8 @@ module ActiveRecord # Returns the size of the collection calling +size+ on the target. # If the collection has been already loaded, +length+ and +size+ are - # equivalent. + # equivalent. If not and you are going to need the records anyway this + # method will take one less query. Otherwise +size+ is more efficient. # # class Person < ActiveRecord::Base # has_many :pets From d168d234e3ce439911a178d1d13f6c2cbf8ff549 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Thu, 29 Nov 2012 13:31:00 -0500 Subject: [PATCH 39/42] nodoc AS::Deprecation::InstanceDelegator class [ci skip] --- .../lib/active_support/deprecation/instance_delegator.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activesupport/lib/active_support/deprecation/instance_delegator.rb b/activesupport/lib/active_support/deprecation/instance_delegator.rb index ff240cb887..8472a58add 100644 --- a/activesupport/lib/active_support/deprecation/instance_delegator.rb +++ b/activesupport/lib/active_support/deprecation/instance_delegator.rb @@ -3,13 +3,13 @@ require 'active_support/core_ext/module/delegation' module ActiveSupport class Deprecation - module InstanceDelegator + module InstanceDelegator # :nodoc: def self.included(base) base.extend(ClassMethods) base.public_class_method :new end - module ClassMethods + module ClassMethods # :nodoc: def include(included_module) included_module.instance_methods.each { |m| method_added(m) } super @@ -21,4 +21,4 @@ module ActiveSupport end end end -end \ No newline at end of file +end From d16a1b9e8b2e94649c42e4320881e84add9ec89d Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 29 Nov 2012 14:25:02 -0800 Subject: [PATCH 40/42] Normalize on 'After reading this guide, you will know:' We have three or four different introduction sentences to the guides. After this commit, we use the same one everywhere. --- guides/source/action_controller_overview.md | 4 +++- guides/source/action_mailer_basics.md | 2 ++ guides/source/action_view_overview.md | 2 +- guides/source/active_model_basics.md | 2 ++ guides/source/active_record_basics.md | 4 +++- guides/source/active_record_querying.md | 4 +++- guides/source/active_record_validations_callbacks.md | 2 +- guides/source/active_support_core_extensions.md | 2 +- guides/source/active_support_instrumentation.md | 4 +++- guides/source/api_documentation_guidelines.md | 2 ++ guides/source/asset_pipeline.md | 3 ++- guides/source/association_basics.md | 4 +++- guides/source/caching_with_rails.md | 2 +- guides/source/command_line.md | 2 ++ guides/source/configuring.md | 4 +++- guides/source/contributing_to_ruby_on_rails.md | 4 +++- guides/source/debugging_rails_applications.md | 4 +++- guides/source/development_dependencies_install.md | 2 ++ guides/source/engines.md | 4 +++- guides/source/form_helpers.md | 2 +- guides/source/generators.md | 2 +- guides/source/getting_started.md | 5 +++-- guides/source/i18n.md | 2 ++ guides/source/initialization.md | 2 ++ guides/source/layouts_and_rendering.md | 2 ++ guides/source/migrations.md | 2 +- guides/source/nested_model_forms.md | 2 +- guides/source/performance_testing.md | 4 +++- guides/source/plugins.md | 2 +- guides/source/rails_application_templates.md | 2 +- guides/source/rails_on_rack.md | 4 +++- guides/source/routing.md | 4 +++- guides/source/ruby_on_rails_guides_guidelines.md | 2 ++ guides/source/security.md | 4 +++- guides/source/testing.md | 4 +++- guides/source/upgrading_ruby_on_rails.md | 2 ++ guides/source/working_with_javascript_in_rails.md | 4 +++- 37 files changed, 80 insertions(+), 28 deletions(-) diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 267ca865c8..69d99becb9 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -1,7 +1,9 @@ Action Controller Overview ========================== -In this guide you will learn how controllers work and how they fit into the request cycle in your application. After reading this guide, you will be able to: +In this guide you will learn how controllers work and how they fit into the request cycle in your application. + +After reading this guide, you will know: * Follow the flow of a request through a controller. * Understand why and how to store data in the session or cookies. diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index ca5a085172..83cb5e5a3f 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -3,6 +3,8 @@ Action Mailer Basics This guide should provide you with all you need to get started in sending and receiving emails from and to your application, and many internals of Action Mailer. It also covers how to test your mailers. +After reading this guide, you will know: + -------------------------------------------------------------------------------- Introduction diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md index 648d4ace2c..c931b30bd3 100644 --- a/guides/source/action_view_overview.md +++ b/guides/source/action_view_overview.md @@ -1,7 +1,7 @@ Action View Overview ==================== -In this guide you will learn: +After reading this guide, you will know: * What Action View is and how to use it with Rails. * How best to use templates, partials, and layouts. diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md index 6fecaa32a7..0c278095ab 100644 --- a/guides/source/active_model_basics.md +++ b/guides/source/active_model_basics.md @@ -3,6 +3,8 @@ Active Model Basics This guide should provide you with all you need to get started using model classes. Active Model allows for Action Pack helpers to interact with non-Active Record models. Active Model also helps building custom ORMs for use outside of the Rails framework. +After reading this guide, you will know: + -------------------------------------------------------------------------------- Introduction diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md index a5c088dde4..cb64cf39f3 100644 --- a/guides/source/active_record_basics.md +++ b/guides/source/active_record_basics.md @@ -1,7 +1,9 @@ Active Record Basics ==================== -This guide is an introduction to Active Record. After reading this guide we hope that you'll learn: +This guide is an introduction to Active Record. + +After reading this guide, you will know: * What Object Relational Mapping and Active Record are and how they are used in Rails. * How Active Record fits into the Model-View-Controller paradigm. diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 3fc6d3e2c6..9620270141 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1,7 +1,9 @@ Active Record Query Interface ============================= -This guide covers different ways to retrieve data from the database using Active Record. By referring to this guide, you will be able to: +This guide covers different ways to retrieve data from the database using Active Record. + +After reading this guide, you will know: * Find records using a variety of methods and conditions. * Specify the order, retrieved attributes, grouping, and other properties of the found records. diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index fb3b609342..18b73d8805 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/guides/source/active_record_validations_callbacks.md @@ -3,7 +3,7 @@ Active Record Validations and Callbacks This guide teaches you how to hook into the life cycle of your Active Record objects. You will learn how to validate the state of objects before they go into the database, and how to perform custom operations at certain points in the object life cycle. -After reading this guide and trying out the presented concepts, we hope that you'll be able to: +After reading this guide, you will know: * Understand the life cycle of Active Record objects. * Use the built-in Active Record validation helpers. diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 401e6f0596..2baf8c2515 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -5,7 +5,7 @@ Active Support is the Ruby on Rails component responsible for providing Ruby lan It offers a richer bottom-line at the language level, targeted both at the development of Rails applications, and at the development of Ruby on Rails itself. -By referring to this guide you will learn the extensions to the Ruby core classes and modules provided by Active Support. +After reading this guide, you will know: -------------------------------------------------------------------------------- diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index fd3a179726..cf5a51fc5b 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -3,7 +3,9 @@ Active Support Instrumentation Active Support is a part of core Rails that provides Ruby language extensions, utilities and other things. One of the things it includes is an instrumentation API that can be used inside an application to measure certain actions that occur within Ruby code, such as that inside a Rails application or the framework itself. It is not limited to Rails, however. It can be used independently in other Ruby scripts if it is so desired. -In this guide, you will learn how to use the instrumentation API inside of Active Support to measure events inside of Rails and other Ruby code. We cover: +In this guide, you will learn how to use the instrumentation API inside of Active Support to measure events inside of Rails and other Ruby code. + +After reading this guide, you will know: * What instrumentation can provide. * The hooks inside the Rails framework for instrumentation. diff --git a/guides/source/api_documentation_guidelines.md b/guides/source/api_documentation_guidelines.md index 72e412e701..0126fc94d1 100644 --- a/guides/source/api_documentation_guidelines.md +++ b/guides/source/api_documentation_guidelines.md @@ -3,6 +3,8 @@ API Documentation Guidelines This guide documents the Ruby on Rails API documentation guidelines. +After reading this guide, you will know: + -------------------------------------------------------------------------------- RDoc diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 5bed678327..fa4e714950 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -2,7 +2,8 @@ The Asset Pipeline ================== This guide covers the asset pipeline introduced in Rails 3.1. -By referring to this guide you will be able to: + +After reading this guide, you will know: * Understand what the asset pipeline is and what it does. * Properly organize your application assets. diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 2ffbacfebd..43d3b20165 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -1,7 +1,9 @@ Active Record Associations ========================== -This guide covers the association features of Active Record. By referring to this guide, you will be able to: +This guide covers the association features of Active Record. + +After reading this guide, you will know: * Declare associations between Active Record models. * Understand the various types of Active Record associations. diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index 0e9e382fcb..12115a6a47 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -3,7 +3,7 @@ Caching with Rails: An overview This guide will teach you what you need to know about avoiding that expensive round-trip to your database and returning what you need to return to the web clients in the shortest time possible. -After reading this guide, you should be able to use and configure: +After reading this guide, you will know: * Page, action, and fragment caching. * Sweepers. diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 830de1c2bb..0a4a704cd9 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -3,6 +3,8 @@ The Rails Command Line Rails comes with every command line tool you'll need to +After reading this guide, you will know: + * Create a Rails application. * Generate models, controllers, database migrations, and unit tests. * Start a development server. diff --git a/guides/source/configuring.md b/guides/source/configuring.md index 63a6dae5bb..f01051a3fe 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -1,7 +1,9 @@ Configuring Rails Applications ============================== -This guide covers the configuration and initialization features available to Rails applications. By referring to this guide, you will be able to: +This guide covers the configuration and initialization features available to Rails applications. + +After reading this guide, you will know: * Adjust the behavior of your Rails applications. * Add additional code to be run at application start time. diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index 68e27a6e8f..fa6c335088 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -1,7 +1,9 @@ Contributing to Ruby on Rails ============================= -This guide covers ways in which _you_ can become a part of the ongoing development of Ruby on Rails. After reading it, you should be familiar with: +This guide covers ways in which _you_ can become a part of the ongoing development of Ruby on Rails. + +After reading this guide, you will know: * Using GitHub to report issues. * Cloning master and running the test suite. diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md index 7b21cac50e..96112da50f 100644 --- a/guides/source/debugging_rails_applications.md +++ b/guides/source/debugging_rails_applications.md @@ -1,7 +1,9 @@ Debugging Rails Applications ============================ -This guide introduces techniques for debugging Ruby on Rails applications. By referring to this guide, you will be able to: +This guide introduces techniques for debugging Ruby on Rails applications. + +After reading this guide, you will know: * Understand the purpose of debugging. * Track down problems and issues in your application that your tests aren't identifying. diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index 7dfb39fb81..79d59859c8 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -3,6 +3,8 @@ Development Dependencies Install This guide covers how to setup an environment for Ruby on Rails core development. +After reading this guide, you will know: + -------------------------------------------------------------------------------- The Easy Way diff --git a/guides/source/engines.md b/guides/source/engines.md index 7d0b0dd964..f1e2780eae 100644 --- a/guides/source/engines.md +++ b/guides/source/engines.md @@ -1,7 +1,9 @@ Getting Started with Engines ============================ -In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface. You will learn the following things in this guide: +In this guide you will learn about engines and how they can be used to provide additional functionality to their host applications through a clean and very easy-to-use interface. + +After reading this guide, you will know: * What makes an engine. * How to generate an engine. diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index 2ca387db4b..b89d776d87 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -3,7 +3,7 @@ Form Helpers Forms in web applications are an essential interface for user input. However, form markup can quickly become tedious to write and maintain because of form control naming and their numerous attributes. Rails deals away with these complexities by providing view helpers for generating form markup. However, since they have different use-cases, developers are required to know all the differences between similar helper methods before putting them to use. -In this guide you will: +After reading this guide, you will know: * Create search forms and similar kind of generic forms not representing any specific model in your application. * Make model-centric forms for creation and editing of specific database records. diff --git a/guides/source/generators.md b/guides/source/generators.md index f4698ab6fd..f83f5c6691 100644 --- a/guides/source/generators.md +++ b/guides/source/generators.md @@ -3,7 +3,7 @@ Creating and Customizing Rails Generators & Templates Rails generators are an essential tool if you plan to improve your workflow. With this guide you will learn how to create generators and customize existing ones. -In this guide you will: +After reading this guide, you will know: * Learn how to see which generators are available in your application. * Create a generator using templates. diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index bddf5b3d40..ceba2c65aa 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1,8 +1,9 @@ Getting Started with Rails ========================== -This guide covers getting up and running with Ruby on Rails. After reading it, -you should be familiar with: +This guide covers getting up and running with Ruby on Rails. + +After reading this guide, you will know: * Installing Rails, creating a new Rails application, and connecting your application to a database. diff --git a/guides/source/i18n.md b/guides/source/i18n.md index c07d24fbe5..e1cf21f039 100644 --- a/guides/source/i18n.md +++ b/guides/source/i18n.md @@ -19,6 +19,8 @@ In the process of _localizing_ your application you'll probably want to do the f This guide will walk you through the I18n API and contains a tutorial on how to internationalize a Rails application from the start. +After reading this guide, you will know: + -------------------------------------------------------------------------------- NOTE: The Ruby I18n framework provides you with all necessary means for internationalization/localization of your Rails application. You may, however, use any of various plugins and extensions available, which add additional functionality or features. See the Rails [I18n Wiki](http://rails-i18n.org/wiki) for more information. diff --git a/guides/source/initialization.md b/guides/source/initialization.md index a0aad24ecd..6a34125654 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -4,6 +4,8 @@ The Rails Initialization Process This guide explains the internals of the initialization process in Rails as of Rails 4. It is an extremely in-depth guide and recommended for advanced Rails developers. +After reading this guide, you will know: + * Using `rails server`. -------------------------------------------------------------------------------- diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 9ed01df590..394ef794d3 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -3,6 +3,8 @@ Layouts and Rendering in Rails This guide covers the basic layout features of Action Controller and Action View. By referring to this guide, you will be able to: +After reading this guide, you will know: + * Use the various rendering methods built into Rails. * Create layouts with multiple content sections. * Use partials to DRY up your views. diff --git a/guides/source/migrations.md b/guides/source/migrations.md index e6d2f6e0a9..7b1ca9ea90 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -6,7 +6,7 @@ database schema over time. Rather than write schema modifications in pure SQL, migrations allow you to use an easy Ruby DSL to describe changes to your tables. -In this guide, you'll learn all about migrations including: +After reading this guide, you will know: * The generators you can use to create them. * The methods Active Record provides to manipulate your database. diff --git a/guides/source/nested_model_forms.md b/guides/source/nested_model_forms.md index 49cb451947..2b46a9d51e 100644 --- a/guides/source/nested_model_forms.md +++ b/guides/source/nested_model_forms.md @@ -3,7 +3,7 @@ Rails nested model forms Creating a form for a model _and_ its associations can become quite tedious. Therefore Rails provides helpers to assist in dealing with the complexities of generating these forms _and_ the required CRUD operations to create, update, and destroy associations. -In this guide you will: +After reading this guide, you will know: * do stuff. diff --git a/guides/source/performance_testing.md b/guides/source/performance_testing.md index 248a9643c8..b84c5d1732 100644 --- a/guides/source/performance_testing.md +++ b/guides/source/performance_testing.md @@ -2,7 +2,9 @@ Performance Testing Rails Applications ====================================== This guide covers the various ways of performance testing a Ruby on Rails -application. By referring to this guide, you will be able to: +application. + +After reading this guide, you will know: * Understand the various types of benchmarking and profiling metrics. * Generate performance and benchmarking tests. diff --git a/guides/source/plugins.md b/guides/source/plugins.md index 66f4551355..c7c843ec3a 100644 --- a/guides/source/plugins.md +++ b/guides/source/plugins.md @@ -7,7 +7,7 @@ A Rails plugin is either an extension or a modification of the core framework. P * a segmented architecture so that units of code can be fixed or updated on their own release schedule * an outlet for the core developers so that they don’t have to include every cool new feature under the sun -After reading this guide you should be familiar with: +After reading this guide, you will know: * Creating a plugin from scratch. * Writing and running tests for the plugin. diff --git a/guides/source/rails_application_templates.md b/guides/source/rails_application_templates.md index 25ca09de94..83c563ac78 100644 --- a/guides/source/rails_application_templates.md +++ b/guides/source/rails_application_templates.md @@ -3,7 +3,7 @@ Rails Application Templates Application templates are simple Ruby files containing DSL for adding gems/initializers etc. to your freshly created Rails project or an existing Rails project. -By referring to this guide, you will be able to: +After reading this guide, you will know: * Use templates to generate/customize Rails applications. * Write your own reusable application templates using the Rails template API. diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md index 3f7760609c..531b35a973 100644 --- a/guides/source/rails_on_rack.md +++ b/guides/source/rails_on_rack.md @@ -1,7 +1,9 @@ Rails on Rack ============= -This guide covers Rails integration with Rack and interfacing with other Rack components. By referring to this guide, you will be able to: +This guide covers Rails integration with Rack and interfacing with other Rack components. + +After reading this guide, you will know: * Create Rails Metal applications. * Use Rack Middlewares in your Rails applications. diff --git a/guides/source/routing.md b/guides/source/routing.md index 69c36aa073..7d43854f2f 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -1,7 +1,9 @@ Rails Routing from the Outside In ================================= -This guide covers the user-facing features of Rails routing. By referring to this guide, you will be able to: +This guide covers the user-facing features of Rails routing. + +After reading this guide, you will know: * Understand the code in `routes.rb`. * Construct your own routes, using either the preferred resourceful style or the `match` method. diff --git a/guides/source/ruby_on_rails_guides_guidelines.md b/guides/source/ruby_on_rails_guides_guidelines.md index e589a3d093..6e3173cdb4 100644 --- a/guides/source/ruby_on_rails_guides_guidelines.md +++ b/guides/source/ruby_on_rails_guides_guidelines.md @@ -3,6 +3,8 @@ Ruby on Rails Guides Guidelines This guide documents guidelines for writing Ruby on Rails Guides. This guide follows itself in a graceful loop, serving itself as an example. +After reading this guide, you will know: + -------------------------------------------------------------------------------- Markdown diff --git a/guides/source/security.md b/guides/source/security.md index 98fc49c8c1..6c32a8ff5b 100644 --- a/guides/source/security.md +++ b/guides/source/security.md @@ -1,7 +1,9 @@ Ruby On Rails Security Guide ============================ -This manual describes common security problems in web applications and how to avoid them with Rails. After reading it, you should be familiar with: +This manual describes common security problems in web applications and how to avoid them with Rails. + +After reading this guide, you will know: * All countermeasures _that are highlighted_. * The concept of sessions in Rails, what to put in there and popular attack methods. diff --git a/guides/source/testing.md b/guides/source/testing.md index cb6a768759..9ce94f4c53 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -2,7 +2,9 @@ A Guide to Testing Rails Applications ===================================== This guide covers built-in mechanisms offered by Rails to test your -application. By referring to this guide, you will be able to: +application. + +After reading this guide, you will know: * Understand Rails testing terminology. * Write unit, functional, and integration tests for your application. diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 295b5148ae..bdb4730cdc 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -3,6 +3,8 @@ A Guide for Upgrading Ruby on Rails This guide provides steps to be followed when you upgrade your applications to a newer version of Ruby on Rails. These steps are also available in individual release guides. +After reading this guide, you will know: + -------------------------------------------------------------------------------- General Advice diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index ec720bd0a2..26e3403ff9 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -3,7 +3,9 @@ Working with JavaScript in 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: +ease! + +After reading this guide, you will know: * Quick introduction to Ajax. * Unobtrusive JavaScript. From daab9bba887ec0682620087c39a0b4c097fc6efc Mon Sep 17 00:00:00 2001 From: Florent Guilleux Date: Sat, 1 Dec 2012 11:23:02 -0500 Subject: [PATCH 41/42] Fix Calculations#pluck doc to mention several attributes can be selected [ci skip] --- activerecord/lib/active_record/relation/calculations.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 72b035a023..d969660a8a 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -111,8 +111,8 @@ module ActiveRecord 0 end - # Use pluck as a shortcut to select a single attribute without - # loading a bunch of records just to grab one attribute you want. + # Use pluck as a shortcut to select one or more attributes without + # loading a bunch of records just to grab the attributes you want. # # Person.pluck(:name) # @@ -121,7 +121,7 @@ module ActiveRecord # Person.all.map(&:name) # # Pluck returns an Array of attribute values type-casted to match - # the plucked column name, if it can be deduced. Plucking an SQL fragment + # the plucked column names, if it can be deduced. Plucking an SQL fragment # returns String values by default. # # Examples: From 9685019c4a15eb0222984748e7413dc5920195f4 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 1 Dec 2012 22:59:10 +0530 Subject: [PATCH 42/42] copy edits [ci skip] --- activerecord/lib/active_record/associations/collection_proxy.rb | 2 +- activerecord/lib/active_record/relation/calculations.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb index a9a4eb8728..07a5d07256 100644 --- a/activerecord/lib/active_record/associations/collection_proxy.rb +++ b/activerecord/lib/active_record/associations/collection_proxy.rb @@ -672,7 +672,7 @@ module ActiveRecord end # Returns the size of the collection. If the collection hasn't been loaded, - # it executes a SELECT COUNT(*) query. If it has, calls collection.size. + # it executes a SELECT COUNT(*) query. Else it calls collection.size. # # If the collection has been already loaded +size+ and +length+ are # equivalent. If not and you are going to need the records anyway diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index d969660a8a..99e77e007a 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -121,7 +121,7 @@ module ActiveRecord # Person.all.map(&:name) # # Pluck returns an Array of attribute values type-casted to match - # the plucked column names, if it can be deduced. Plucking an SQL fragment + # the plucked column names, if they can be deduced. Plucking an SQL fragment # returns String values by default. # # Examples: