From d5c7257e75ba0d0fdd356fdb12e4be18e4701a30 Mon Sep 17 00:00:00 2001 From: capps Date: Mon, 11 Mar 2013 08:10:43 -0700 Subject: I think "uniq" is more Rails-y than select("distinct(categories.id)") --- guides/source/active_record_querying.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 4a4f814917..e83c04d11e 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -970,7 +970,7 @@ SELECT categories.* FROM categories INNER JOIN posts ON posts.category_id = categories.id ``` -Or, in English: "return a Category object for all categories with posts". Note that you will see duplicate categories if more than one post has the same category. If you want unique categories, you can use `Category.joins(:posts).select("distinct(categories.id)")`. +Or, in English: "return a Category object for all categories with posts". Note that you will see duplicate categories if more than one post has the same category. If you want unique categories, you can use `Category.joins(:posts).uniq`. #### Joining Multiple Associations -- cgit v1.2.3 From 8b3483f0a8144d0093108acc28d50814076dcf73 Mon Sep 17 00:00:00 2001 From: Angelo capilleri Date: Wed, 13 Mar 2013 14:11:46 +0100 Subject: absence validator doc --- guides/source/active_record_validations.md | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'guides') diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md index 32641d04c1..7dbe464f34 100644 --- a/guides/source/active_record_validations.md +++ b/guides/source/active_record_validations.md @@ -530,6 +530,47 @@ field you should use `validates :field_name, inclusion: { in: [true, false] }`. The default error message is _"can't be empty"_. +### `absence` + +This helper validates that the specified attributes are absent. It uses the +`present?` method to check if the value is not either nil or a blank string, that +is, a string that is either empty or consists of whitespace. + +```ruby +class Person < ActiveRecord::Base + validates :name, :login, :email, absence: true +end +``` + +If you want to be sure that an association is absent, you'll need to test +whether the associated object itself is absent, and not the foreign key used +to map the association. + +```ruby +class LineItem < ActiveRecord::Base + belongs_to :order + validates :order, absence: true +end +``` + +In order to validate associated records whose absence is required, you must +specify the `:inverse_of` option for the association: + +```ruby +class Order < ActiveRecord::Base + has_many :line_items, inverse_of: :order +end +``` + +If you validate the absence of an object associated via a `has_one` or +`has_many` relationship, it will check that the object is neither `present?` nor +`marked_for_destruction?`. + +Since `false.present?` is false, if you want to validate the presence of a boolean +field you should use `validates :field_name, inclusion: { in: [true, false] }`. + +The default error message is _"must be blank"_. + ### `uniqueness` This helper validates that the attribute's value is unique right before the -- cgit v1.2.3 From 74c3b7f6f61c1115b7409cb8ce9d6832ef9caa75 Mon Sep 17 00:00:00 2001 From: Angelo capilleri Date: Wed, 13 Mar 2013 14:18:37 +0100 Subject: fix absence validator doc for boolean field --- guides/source/active_record_validations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md index 7dbe464f34..df39d3c5dc 100644 --- a/guides/source/active_record_validations.md +++ b/guides/source/active_record_validations.md @@ -566,8 +566,8 @@ If you validate the absence of an object associated via a `has_one` or `has_many` relationship, it will check that the object is neither `present?` nor `marked_for_destruction?`. -Since `false.present?` is false, if you want to validate the presence of a boolean -field you should use `validates :field_name, inclusion: { in: [true, false] }`. +Since `false.present?` is false, if you want to validate the absence of a boolean +field you should use `validates :field_name, exclusion: { in: [true, false] }`. The default error message is _"must be blank"_. -- cgit v1.2.3 From e23413bfcae72f52258658e1b5ba1f061467077d Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 14 Mar 2013 02:02:56 +0530 Subject: fix missing to --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 7e0a8a43d4..624b93da28 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -281,7 +281,7 @@ root-key because normally it does not exist when calling `new`: params.fetch(:blog, {}).permit(:title, :author) ``` -`accepts_nested_attributes_for` allows you update and destroy the +`accepts_nested_attributes_for` allows you to update and destroy associated records. This is based on the `id` and `_destroy` parameters: -- cgit v1.2.3 From d41c279bf12de4722d4cf781929e491e588a612c Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 14 Mar 2013 10:12:54 +0530 Subject: do some typo fixing --- guides/source/active_record_querying.md | 2 +- guides/source/active_support_core_extensions.md | 2 +- guides/source/active_support_instrumentation.md | 4 ++-- guides/source/form_helpers.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'guides') diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index e83c04d11e..3809cad7eb 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -1297,7 +1297,7 @@ recommended that you use the block form of `unscoped`: ```ruby Client.unscoped { - Client.created_before(Time.zome.now) + Client.created_before(Time.zone.now) } ``` diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 517db0d222..ff601fb9cf 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -1344,7 +1344,7 @@ The second argument, `indent_string`, specifies which indent string to use. The "foo".indent(2, "\t") # => "\t\tfoo" ``` -While `indent_string` is tipically one space or tab, it may be any string. +While `indent_string` is typically one space or tab, it may be any string. The third argument, `indent_empty_lines`, is a flag that says whether empty lines should be indented. Default is false. diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index d08000eb69..b1ab700f59 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -273,7 +273,7 @@ Action Mailer to: ["users@rails.com", "ddh@rails.com"], from: ["me@rails.com"], date: Sat, 10 Mar 2012 14:18:09 +0100, - mail: "..." # ommitted for beverity + mail: "..." # omitted for brevity } ``` @@ -299,7 +299,7 @@ Action Mailer to: ["users@rails.com", "ddh@rails.com"], from: ["me@rails.com"], date: Sat, 10 Mar 2012 14:18:09 +0100, - mail: "..." # ommitted for beverity + mail: "..." # omitted for brevity } ``` diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index b8681d493a..dd641c2e29 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -423,7 +423,7 @@ Whenever Rails sees that the internal value of an option being generated matches TIP: The second argument to `options_for_select` must be exactly equal to the desired internal value. In particular if the value is the integer 2 you cannot pass "2" to `options_for_select` — you must pass 2. Be aware of values extracted from the `params` hash as they are all strings. -WARNING: when `:inlude_blank` or `:prompt:` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. +WARNING: when `:include_blank` or `:prompt:` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. You can add arbitrary attributes to the options using hashes: -- cgit v1.2.3 From 6e0aafbba2300e78ecb8bf956dd5e90b6acf6b94 Mon Sep 17 00:00:00 2001 From: Limon Lin Date: Fri, 15 Mar 2013 13:14:26 +0800 Subject: Should be a symbol not string to defer the choice of layout. [ci skip] --- guides/source/layouts_and_rendering.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index bfd1a7c61b..a3b3472701 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -363,7 +363,7 @@ You can use a symbol to defer the choice of layout until a request is processed: ```ruby class ProductsController < ApplicationController - layout "products_layout" + layout :products_layout def show @product = Product.find(params[:id]) -- cgit v1.2.3 From aec466e75294be177f66472fcdbd392831b26fdd Mon Sep 17 00:00:00 2001 From: Tim Lowrimore Date: Fri, 15 Mar 2013 12:36:16 -0500 Subject: added details to section 4.1.2 of the Asset Pipeline guide, describing how to configure Apache to serve the gzipped version of the precompiled assets --- guides/source/asset_pipeline.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index e939606c88..aa0e0a3042 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -547,7 +547,35 @@ This directive is available if the core module that provides this feature was co If you're compiling nginx with Phusion Passenger you'll need to pass that option when prompted. -A robust configuration for Apache is possible but tricky; please Google around. (Or help update this Guide if you have a good example configuration for Apache.) +Apache is also able to serve the [gzipped](http://en.wikipedia.org/wiki/Gzip) version of your assets; however, it requires a bit more work: + +```apache + + Header unset ETag + FileETag None + + # RFC says only cache for 1 year + ExpiresActive On + ExpiresDefault "access plus 1 year" + + RewriteEngine On + RewriteCond %{HTTP:Accept-Encoding} gzip + RewriteCond %{HTTP_USER_AGENT} !Konqueror + RewriteCond %{REQUEST_FILENAME}.gz -f + RewriteRule ^(.+).(css|js)$ $1.$2.gz [QSA,L] + + + + ForceType text/css + + + + ForceType application/javascript + +AddEncoding gzip .gz +``` + +NOTE: You will need to make sure `mod_headers`, `mod_mime` and `mod_rewrite` are loaded; otherwise, the above configuration will fail. ### Local Precompilation -- cgit v1.2.3 From 0ddae9fcf6a648b48cf06562a95618ea6c84fbbb Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Fri, 15 Mar 2013 22:48:41 +0300 Subject: fix typo in form helpers guide --- guides/source/form_helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index dd641c2e29..4e935442cc 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -423,7 +423,7 @@ Whenever Rails sees that the internal value of an option being generated matches TIP: The second argument to `options_for_select` must be exactly equal to the desired internal value. In particular if the value is the integer 2 you cannot pass "2" to `options_for_select` — you must pass 2. Be aware of values extracted from the `params` hash as they are all strings. -WARNING: when `:include_blank` or `:prompt:` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. +WARNING: when `:include_blank` or `:prompt` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. You can add arbitrary attributes to the options using hashes: -- cgit v1.2.3 From 3aa3880cfb86d7330db573a31066fd8ef897f180 Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sat, 16 Mar 2013 01:02:21 +0300 Subject: fix markup of controllers guide --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 624b93da28..c13eb8512f 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -232,7 +232,7 @@ The permitted scalar types are `String`, `Symbol`, `NilClass`, `StringIO`, `IO`, `ActionDispatch::Http::UploadedFile` and `Rack::Test::UploadedFile`. -To declare that the value in `params+ must be an array of permitted +To declare that the value in `params` must be an array of permitted scalar values map the key to an empty array: ```ruby -- cgit v1.2.3 From 65d681f5e351fa7c7d117ecebe8b7a95f9ebea8d Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sat, 16 Mar 2013 01:14:54 +0300 Subject: Update action_controller_overview.md --- guides/source/action_controller_overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index c13eb8512f..55aab1ef93 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -239,8 +239,8 @@ scalar values map the key to an empty array: params.permit(:id => []) ``` -To whitelist an entire hash of parameters, the `permit!+ method can be -used +To whitelist an entire hash of parameters, the `permit!` method can be +used: ```ruby params.require(:log_entry).permit! -- cgit v1.2.3 From 387928c2348880c5801b422805a069e7c4910289 Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sat, 16 Mar 2013 11:08:01 +0300 Subject: Capitalize first letter in sentence --- guides/source/routing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/routing.md b/guides/source/routing.md index d7a4a237ed..24cd12713c 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -850,7 +850,7 @@ resources :user_permissions, controller: 'admin/user_permissions' This will route to the `Admin::UserPermissions` controller. -NOTE: Only the directory notation is supported. specifying the +NOTE: Only the directory notation is supported. Specifying the controller with ruby constant notation (eg. `:controller => 'Admin::UserPermissions'`) can lead to routing problems and results in a warning. -- cgit v1.2.3 From 455948c5080031811f11dcc075095a2bb650e61b Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Mon, 18 Mar 2013 06:38:10 -0500 Subject: The default route has been removed --- guides/source/routing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/routing.md b/guides/source/routing.md index 24cd12713c..04098f0a5c 100644 --- a/guides/source/routing.md +++ b/guides/source/routing.md @@ -530,7 +530,7 @@ In particular, simple routing makes it very easy to map legacy URLs to new Rails ### Bound Parameters -When you set up a regular route, you supply a series of symbols that Rails maps to parts of an incoming HTTP request. Two of these symbols are special: `:controller` maps to the name of a controller in your application, and `:action` maps to the name of an action within that controller. For example, consider one of the default Rails routes: +When you set up a regular route, you supply a series of symbols that Rails maps to parts of an incoming HTTP request. Two of these symbols are special: `:controller` maps to the name of a controller in your application, and `:action` maps to the name of an action within that controller. For example, consider this route: ```ruby get ':controller(/:action(/:id))' -- cgit v1.2.3 From 428ff5a896da24490522040a947d7b7c369855c7 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Wed, 20 Mar 2013 01:23:34 +0530 Subject: more typos in guides --- guides/source/asset_pipeline.md | 2 +- guides/source/form_helpers.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index aa0e0a3042..448f0e1f9a 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -768,7 +768,7 @@ end ``` Now that you have a `Template` class, it's time to associate it with an -extenstion for template files: +extension for template files: ```ruby Sprockets.register_engine '.bang', BangBang::Template diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index 4e935442cc..dd641c2e29 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -423,7 +423,7 @@ Whenever Rails sees that the internal value of an option being generated matches TIP: The second argument to `options_for_select` must be exactly equal to the desired internal value. In particular if the value is the integer 2 you cannot pass "2" to `options_for_select` — you must pass 2. Be aware of values extracted from the `params` hash as they are all strings. -WARNING: when `:include_blank` or `:prompt` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. +WARNING: when `:include_blank` or `:prompt:` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. You can add arbitrary attributes to the options using hashes: -- cgit v1.2.3 From 926357040b7c5e19efb3bd1b51338621577d0138 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Wed, 20 Mar 2013 01:50:53 +0530 Subject: fix introduced `:` ; fix another typo --- guides/source/active_support_instrumentation.md | 2 +- guides/source/form_helpers.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index b1ab700f59..69421e6876 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -465,7 +465,7 @@ Creating custom events Adding your own events is easy as well. `ActiveSupport::Notifications` will take care of all the heavy lifting for you. Simply call `instrument` with a `name`, `payload` and a block. The notification will be sent after the block returns. `ActiveSupport` will generate the start and end times -as well as the unique ID. All data passed into the `insturment` call will make it into the payload. +as well as the unique ID. All data passed into the `instrument` call will make it into the payload. Here's an example: diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md index dd641c2e29..4e935442cc 100644 --- a/guides/source/form_helpers.md +++ b/guides/source/form_helpers.md @@ -423,7 +423,7 @@ Whenever Rails sees that the internal value of an option being generated matches TIP: The second argument to `options_for_select` must be exactly equal to the desired internal value. In particular if the value is the integer 2 you cannot pass "2" to `options_for_select` — you must pass 2. Be aware of values extracted from the `params` hash as they are all strings. -WARNING: when `:include_blank` or `:prompt:` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. +WARNING: when `:include_blank` or `:prompt` are not present, `:include_blank` is forced true if the select attribute `required` is true, display `size` is one and `multiple` is not true. You can add arbitrary attributes to the options using hashes: -- cgit v1.2.3 From 5dfaf8b5b5d6175fc6dc1992f47f6ac740bdc011 Mon Sep 17 00:00:00 2001 From: Ryan Sandridge Date: Tue, 19 Mar 2013 18:05:44 -0400 Subject: Update documentation for Where chained modifiers. where.like and where.not_like were removed in 8d02afeaee, but the guide was not updated. --- guides/source/active_record_querying.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'guides') diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md index 3809cad7eb..fcdb342a03 100644 --- a/guides/source/active_record_querying.md +++ b/guides/source/active_record_querying.md @@ -505,19 +505,15 @@ This code will generate SQL like this: SELECT * FROM clients WHERE (clients.orders_count IN (1,3,5)) ``` -### NOT, LIKE, and NOT LIKE Conditions +### NOT Conditions -`NOT`, `LIKE`, and `NOT LIKE` SQL queries can be built by `where.not`, `where.like`, and `where.not_like` respectively. +`NOT` SQL queries can be built by `where.not`. ```ruby Post.where.not(author: author) - -Author.where.like(name: 'Nari%') - -Developer.where.not_like(name: 'Tenderl%') ``` -In other words, these sort of queries can be generated by calling `where` with no argument, then immediately chain with `not`, `like`, or `not_like` passing `where` conditions. +In other words, this query can be generated by calling `where` with no argument, then immediately chain with `not` passing `where` conditions. Ordering -------- -- cgit v1.2.3 From b9b8b240098eec098904cf084f751f8bf8cc7bcc Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Thu, 21 Mar 2013 20:37:09 +0530 Subject: Added link to Turbolinks Railscast --- guides/source/working_with_javascript_in_rails.md | 1 + 1 file changed, 1 insertion(+) (limited to 'guides') diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index 7c4192ee26..ddefaf6ff8 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -394,3 +394,4 @@ Here are some helpful links to help you learn even more: * [jquery-ujs list of external articles](https://github.com/rails/jquery-ujs/wiki/External-articles) * [Rails 3 Remote Links and Forms: A Definitive Guide](http://www.alfajango.com/blog/rails-3-remote-links-and-forms/) * [Railscasts: Unobtrusive JavaScript](http://railscasts.com/episodes/205-unobtrusive-javascript) +* [Railscasts: Turbolinks](http://railscasts.com/episodes/390-turbolinks) \ No newline at end of file -- cgit v1.2.3 From 573df1cf2a5d5d1f288c8a4a5d76194675141832 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Thu, 21 Mar 2013 20:41:45 +0530 Subject: Using American English spellings over British style spellings --- guides/source/upgrading_ruby_on_rails.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index cb43781f52..535d536dea 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -67,7 +67,7 @@ Rails 4.0 extracted Active Resource to its own gem. If you still need the featur * Rails 4.0 has changed how errors attach with the `ActiveModel::Validations::ConfirmationValidator`. Now when confirmation validations fail, the error will be attached to `:#{attribute}_confirmation` instead of `attribute`. -* Rails 4.0 has changed `ActiveModel::Serializers::JSON.include_root_in_json` default value to `false`. Now, Active Model Serializers and Active Record objects have the same default behaviour. This means that you can comment or remove the following option in the `config/initializers/wrap_parameters.rb` file: +* Rails 4.0 has changed `ActiveModel::Serializers::JSON.include_root_in_json` default value to `false`. Now, Active Model Serializers and Active Record objects have the same default behavior. This means that you can comment or remove the following option in the `config/initializers/wrap_parameters.rb` file: ```ruby # Disable root element in JSON by default. @@ -284,7 +284,7 @@ config.assets.debug = true Again, most of the changes below are for the asset pipeline. You can read more about these in the [Asset Pipeline](asset_pipeline.html) guide. ```ruby -# Compress JavaScripts and CSS +# Compress JavaScript and CSS config.assets.compress = true # Don't fallback to assets pipeline if a precompiled asset is missed -- cgit v1.2.3 From 18f9d46d4ff0c9be6f4561d06d66f4c55b81731c Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Fri, 22 Mar 2013 00:56:39 -0700 Subject: fix the initializer block example and clarify clarify that the contents of the block is expected to return a string. the previous example executed puts and the initializer got nothing. also, made it consistent with the single-line example to be more clear as to what's going on --- guides/source/generators.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/generators.md b/guides/source/generators.md index d7c789e2d8..a8a34d0ac4 100644 --- a/guides/source/generators.md +++ b/guides/source/generators.md @@ -589,11 +589,11 @@ Creates an initializer in the `config/initializers` directory of the application initializer "begin.rb", "puts 'this is the beginning'" ``` -This method also takes a block: +This method also takes a block, expected to return a string: ```ruby initializer "begin.rb" do - puts "Almost done!" + "puts 'this is the beginning'" end ``` -- cgit v1.2.3 From 5be6122c399ca15c8f1bf7051f12bfee2b85e1c1 Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Fri, 22 Mar 2013 10:27:41 -0300 Subject: Add minitest-spec-rails to guide's testing options --- guides/source/testing.md | 1 + 1 file changed, 1 insertion(+) (limited to 'guides') diff --git a/guides/source/testing.md b/guides/source/testing.md index 540197e6e7..e2a8fe7f30 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -977,5 +977,6 @@ The built-in `test/unit` based testing is not the only way to test Rails applica * [NullDB](http://avdi.org/projects/nulldb/), a way to speed up testing by avoiding database use. * [Factory Girl](https://github.com/thoughtbot/factory_girl/tree/master), a replacement for fixtures. * [Machinist](https://github.com/notahat/machinist/tree/master), another replacement for fixtures. +* [MiniTest::Spec Rails](https://github.com/metaskills/minitest-spec-rails), use the MiniTest::Spec DSL within your rails tests. * [Shoulda](http://www.thoughtbot.com/projects/shoulda), an extension to `test/unit` with additional helpers, macros, and assertions. * [RSpec](http://relishapp.com/rspec), a behavior-driven development framework -- cgit v1.2.3 From d45145acdc576e46a1f1719d69bec96b5bf07b0a Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 24 Mar 2013 00:34:06 +0530 Subject: Changed 'args' to 'arguments' when used in places other than code with fixing few more typos --- guides/source/active_support_instrumentation.md | 2 +- guides/source/command_line.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 69421e6876..0f33c58011 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -428,7 +428,7 @@ end ``` Defining all those block arguments each time can be tedious. You can easily create an `ActiveSupport::Notifications::Event` -from block args like this: +from block arguments like this: ```ruby ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args| diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 9d1fb03fab..7669b5edeb 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -82,7 +82,7 @@ The server can be run on a different port using the `-p` option. The default dev $ rails server -e production -p 4000 ``` -The `-b` option binds Rails to the specified ip, by default it is 0.0.0.0. You can run a server as a daemon by passing a `-d` option. +The `-b` option binds Rails to the specified IP, by default it is 0.0.0.0. You can run a server as a daemon by passing a `-d` option. ### `rails generate` -- cgit v1.2.3 From a2bb6720fd5091d95aa8539ddf63386dcfb8feee Mon Sep 17 00:00:00 2001 From: Chao Ren Date: Sat, 23 Mar 2013 20:57:14 -0700 Subject: Typo: Migration class name would use plural --- guides/source/association_basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index 65c8154064..18d9f5c562 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -572,7 +572,7 @@ end These need to be backed up by a migration to create the `assemblies_parts` table. This table should be created without a primary key: ```ruby -class CreateAssemblyPartJoinTable < ActiveRecord::Migration +class CreateAssembliesPartsJoinTable < ActiveRecord::Migration def change create_table :assemblies_parts, id: false do |t| t.integer :assembly_id -- cgit v1.2.3 From 9a5d4288c59686af4acc8b3de7cb3283c5f5974c Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 24 Mar 2013 15:59:33 +0900 Subject: s/app\/model\//app\/models\//g --- guides/source/command_line.md | 8 ++++---- guides/source/migrations.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'guides') diff --git a/guides/source/command_line.md b/guides/source/command_line.md index 7669b5edeb..4711186522 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -414,7 +414,7 @@ app/controllers/admin/users_controller.rb: * [ 20] [TODO] any other way to do this? * [132] [FIXME] high priority for next deploy -app/model/school.rb: +app/models/school.rb: * [ 13] [OPTIMIZE] refactor this code to make it faster * [ 17] [FIXME] ``` @@ -427,7 +427,7 @@ $ rake notes:fixme app/controllers/admin/users_controller.rb: * [132] high priority for next deploy -app/model/school.rb: +app/models/school.rb: * [ 17] ``` @@ -436,7 +436,7 @@ You can also use custom annotations in your code and list them using `rake notes ```bash $ rake notes:custom ANNOTATION=BUG (in /home/foobar/commandsapp) -app/model/post.rb: +app/models/post.rb: * [ 23] Have to fix this one before pushing! ``` @@ -448,7 +448,7 @@ By default, `rake notes` will look in the `app`, `config`, `lib`, `bin` and `tes $ export SOURCE_ANNOTATION_DIRECTORIES='rspec,vendor' $ rake notes (in /home/foobar/commandsapp) -app/model/user.rb: +app/models/user.rb: * [ 35] [FIXME] User should have a subscription at this point rspec/model/user_spec.rb: * [122] [TODO] Verify the user that has a subscription works diff --git a/guides/source/migrations.md b/guides/source/migrations.md index bd63970bea..086cf434d9 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -831,7 +831,7 @@ end ``` ```ruby -# app/model/product.rb +# app/models/product.rb class Product < ActiveRecord::Base validates :flag, presence: true @@ -856,7 +856,7 @@ end ``` ```ruby -# app/model/product.rb +# app/models/product.rb class Product < ActiveRecord::Base validates :flag, :fuzz, presence: true -- cgit v1.2.3 From 64dc614ca58732409695032c1458e6a4283a4fbb Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 24 Mar 2013 13:26:02 +0530 Subject: view/views, asset/assets --- guides/source/action_view_overview.md | 2 +- guides/source/getting_started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'guides') diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md index 4cdac43a7e..3b5963efc2 100644 --- a/guides/source/action_view_overview.md +++ b/guides/source/action_view_overview.md @@ -492,7 +492,7 @@ image_path("edit.png") # => /assets/edit-2d1a2db63fc738690021fedb5a65b68e.png #### image_url -Computes the url to an image asset in the `app/asset/images` directory. This will call `image_path` internally and merge with your current host or your asset host. +Computes the url to an image asset in the `app/assets/images` directory. This will call `image_path` internally and merge with your current host or your asset host. ```ruby image_url("edit.png") # => http://www.example.com/assets/edit.png diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index a1d7e955c8..c9eeb9fab6 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -568,7 +568,7 @@ interested in. We also use an instance variable (prefixed by `@`) to hold a reference to the post object. We do this because Rails will pass all instance variables to the view. -Now, create a new file `app/view/posts/show.html.erb` with the following +Now, create a new file `app/views/posts/show.html.erb` with the following content: ```html+erb -- cgit v1.2.3 From 11c58831c3f72be9350a11b44360f7f41c6e2b60 Mon Sep 17 00:00:00 2001 From: Deshi Xiao Date: Sun, 24 Mar 2013 17:16:06 +0800 Subject: correct test command's typo --- guides/source/testing.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'guides') diff --git a/guides/source/testing.md b/guides/source/testing.md index e2a8fe7f30..ce8d12dc21 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -66,7 +66,7 @@ Here's a sample YAML fixture file: ```yaml # lo & behold! I am a YAML comment! -david: +jjjjkkkkkjjjjjjjjjkkkk: name: David Heinemeier Hansson birthday: 1979-10-15 profession: Systems development @@ -129,12 +129,12 @@ When you use `rails generate scaffold`, for a resource among other things it cre $ rails generate scaffold post title:string body:text ... create app/models/post.rb -create test/models/post_test.rb +create test/unit/post_test.rb create test/fixtures/posts.yml ... ``` -The default test stub in `test/models/post_test.rb` looks like this: +The default test stub in `test/unit/post_test.rb` looks like this: ```ruby require 'test_helper' @@ -227,7 +227,7 @@ TIP: You can see all these rake tasks and their descriptions by running `rake -- Running a test is as simple as invoking the file containing the test cases through Ruby: ```bash -$ ruby -Itest test/models/post_test.rb +$ ruby -Itest test/unit/post_test.rb Loaded suite models/post_test Started @@ -242,9 +242,9 @@ This will run all the test methods from the test case. Note that `test_helper.rb You can also run a particular test method from the test case by using the `-n` switch with the `test method name`. ```bash -$ ruby -Itest test/models/post_test.rb -n test_the_truth +$ ruby -Itest test/unit/post_test.rb -n test_the_truth -Loaded suite models/post_test +Loaded suite unit/post_test Started . Finished in 0.023513 seconds. @@ -266,7 +266,7 @@ end Let us run this newly added test. ```bash -$ ruby unit/post_test.rb -n test_should_not_save_post_without_title +$ ruby -Itest test/unit/post_test.rb -n test_should_not_save_post_without_title Loaded suite -e Started F @@ -308,7 +308,7 @@ end Now the test should pass. Let us verify by running the test again: ```bash -$ ruby unit/post_test.rb -n test_should_not_save_post_without_title +$ ruby -Itest test/unit/post_test.rb -n test_should_not_save_post_without_title Loaded suite unit/post_test Started . @@ -334,7 +334,7 @@ end Now you can see even more output in the console from running the tests: ```bash -$ ruby unit/post_test.rb -n test_should_report_error +$ ruby -Itest test/unit/post_test.rb -n test_should_report_error Loaded suite -e Started E @@ -688,9 +688,9 @@ class UserFlowsTest < ActionDispatch::IntegrationTest get "/login" assert_response :success - post_via_redirect "/login", username: users(:avs).username, password: users(:avs).password + post_via_redirect "/login", username: users(:david).username, password: users(:david).password assert_equal '/welcome', path - assert_equal 'Welcome avs!', flash[:notice] + assert_equal 'Welcome david!', flash[:notice] https!(false) get "/posts/all" @@ -713,12 +713,12 @@ class UserFlowsTest < ActionDispatch::IntegrationTest test "login and browse site" do # User avs logs in - avs = login(:avs) + avs = login(:david) # User guest logs in guest = login(:guest) # Both are now available in different sessions - assert_equal 'Welcome avs!', avs.flash[:notice] + assert_equal 'Welcome david!', avs.flash[:notice] assert_equal 'Welcome guest!', guest.flash[:notice] # User avs can browse site -- cgit v1.2.3 From 5d5ade2b4122a73abd3498c815fd587ca185b19f Mon Sep 17 00:00:00 2001 From: Deshi Xiao Date: Sun, 24 Mar 2013 17:19:10 +0800 Subject: correct some typo in earlier commit. --- guides/source/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/testing.md b/guides/source/testing.md index ce8d12dc21..7b206f8b4a 100644 --- a/guides/source/testing.md +++ b/guides/source/testing.md @@ -66,7 +66,7 @@ Here's a sample YAML fixture file: ```yaml # lo & behold! I am a YAML comment! -jjjjkkkkkjjjjjjjjjkkkk: +david: name: David Heinemeier Hansson birthday: 1979-10-15 profession: Systems development -- cgit v1.2.3 From 0db928a63aee9ab5d9c277d551f17e28d860c8ae Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Mon, 25 Mar 2013 00:20:25 +0530 Subject: fix some typos --- guides/source/configuring.md | 4 ++-- guides/source/contributing_to_ruby_on_rails.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'guides') diff --git a/guides/source/configuring.md b/guides/source/configuring.md index dbbeec7126..9ea493325d 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -646,7 +646,7 @@ Below is a comprehensive list of all the initializers found in Rails in the orde * `active_support.initialize_time_zone` Sets the default time zone for the application based on the `config.time_zone` setting, which defaults to "UTC". -* `active_support.initialize_beginning_of_week` Sets the default beginnig of week for the application based on `config.beginning_of_week` setting, which defaults to `:monday`. +* `active_support.initialize_beginning_of_week` Sets the default beginning of week for the application based on `config.beginning_of_week` setting, which defaults to `:monday`. * `action_dispatch.configure` Configures the `ActionDispatch::Http::URL.tld_length` to be set to the value of `config.action_dispatch.tld_length`. @@ -698,7 +698,7 @@ Below is a comprehensive list of all the initializers found in Rails in the orde * `engines_blank_point` Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are run. -* `add_generator_templates` Finds templates for generators at `lib/templates` for the application, railities and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference. +* `add_generator_templates` Finds templates for generators at `lib/templates` for the application, railties and engines and adds these to the `config.generators.templates` setting, which will make the templates available for all generators to reference. * `ensure_autoload_once_paths_as_subset` Ensures that the `config.autoload_once_paths` only contains paths from `config.autoload_paths`. If it contains extra paths, then an exception will be raised. diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index cc4e369e7d..d02bee5f02 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -225,7 +225,7 @@ The above are guidelines — please use your best judgment in using them. The CHANGELOG is an important part of every release. It keeps the list of changes for every Rails version. -You should add an entry to the CHANGELOG of the framework that you modified if you're adding or removing a feature, commiting a bug fix or adding deprecation notices. Refactorings and documentation changes generally should not go to the CHANGELOG. +You should add an entry to the CHANGELOG of the framework that you modified if you're adding or removing a feature, committing a bug fix or adding deprecation notices. Refactorings and documentation changes generally should not go to the CHANGELOG. A CHANGELOG entry should summarize what was changed and should end with author's name. You can use multiple lines if you need more space and you can attach code examples indented with 4 spaces. If a change is related to a specific issue, you should attach issue's number. Here is an example CHANGELOG entry: -- cgit v1.2.3 From 0725007fa457bdbbf49c333f8333d5e540ee9a15 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 25 Mar 2013 20:54:34 +0900 Subject: s/Github/GitHub/ --- guides/source/contributing_to_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md index d02bee5f02..c6984b4a41 100644 --- a/guides/source/contributing_to_ruby_on_rails.md +++ b/guides/source/contributing_to_ruby_on_rails.md @@ -190,7 +190,7 @@ $ cd rails $ git checkout -b my_new_branch ``` -It doesn’t matter much what name you use, because this branch will only exist on your local computer and your personal repository on Github. It won't be part of the Rails Git repository. +It doesn’t matter much what name you use, because this branch will only exist on your local computer and your personal repository on GitHub. It won't be part of the Rails Git repository. ### Write Your Code -- cgit v1.2.3 From e21f6c1daccbb5838b1e03e6acdcbc86bbadd7f8 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 25 Mar 2013 21:01:40 +0900 Subject: s/Textmate/TextMate/ --- guides/source/getting_started.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index c9eeb9fab6..faddda0c0a 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -1761,7 +1761,7 @@ cannot be automatically detected by Rails and corrected. Two very common sources of data that are not UTF-8: -* Your text editor: Most text editors (such as Textmate), default to saving files as +* Your text editor: Most text editors (such as TextMate), default to saving files as UTF-8. If your text editor does not, this can result in special characters that you enter in your templates (such as é) to appear as a diamond with a question mark inside in the browser. This also applies to your i18n translation files. -- cgit v1.2.3 From ea5daeb2e407d004cf134d47fe8ac28d24fb0a00 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 25 Mar 2013 22:43:26 +0900 Subject: Fix some typos --- guides/source/active_support_instrumentation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/active_support_instrumentation.md b/guides/source/active_support_instrumentation.md index 0f33c58011..38dbfd3152 100644 --- a/guides/source/active_support_instrumentation.md +++ b/guides/source/active_support_instrumentation.md @@ -442,7 +442,7 @@ ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*a end ``` -Most times you only care about the data itself. Here is a shortuct to just get the data. +Most times you only care about the data itself. Here is a shortcut to just get the data. ```ruby ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args| -- cgit v1.2.3 From f09bf78218288333ed0bb8beff70da33e0366d27 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Mon, 25 Mar 2013 21:09:46 +0530 Subject: localised => localized --- guides/source/active_support_core_extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index ff601fb9cf..43529e3e96 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2198,7 +2198,7 @@ This method accepts three options: * `:words_connector`: What is used to join the elements of arrays with 3 or more elements, except for the last two. Default is ", ". * `:last_word_connector`: What is used to join the last items of an array with 3 or more elements. Default is ", and ". -The defaults for these options can be localised, their keys are: +The defaults for these options can be localized, their keys are: | Option | I18n key | | ---------------------- | ----------------------------------- | -- cgit v1.2.3 From 164af1f9676230a557beed2de7bf7c5d5d7a95aa Mon Sep 17 00:00:00 2001 From: sthollmann Date: Wed, 27 Mar 2013 10:46:19 +0100 Subject: ReCAPTCHA plug-in link now points to Github repo. Plug-in is no longer available at the previous location --- guides/source/security.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/security.md b/guides/source/security.md index 769bd130be..d56ce47b3c 100644 --- a/guides/source/security.md +++ b/guides/source/security.md @@ -432,7 +432,7 @@ Depending on your web application, there may be more ways to hijack the user's a INFO: _A CAPTCHA is a challenge-response test to determine that the response is not generated by a computer. It is often used to protect comment forms from automatic spam bots by asking the user to type the letters of a distorted image. The idea of a negative CAPTCHA is not for a user to prove that he is human, but reveal that a robot is a robot._ -But not only spam robots (bots) are a problem, but also automatic login bots. A popular CAPTCHA API is [reCAPTCHA](http://recaptcha.net/) which displays two distorted images of words from old books. It also adds an angled line, rather than a distorted background and high levels of warping on the text as earlier CAPTCHAs did, because the latter were broken. As a bonus, using reCAPTCHA helps to digitize old books. [ReCAPTCHA](http://ambethia.com/recaptcha/) is also a Rails plug-in with the same name as the API. +But not only spam robots (bots) are a problem, but also automatic login bots. A popular CAPTCHA API is [reCAPTCHA](http://recaptcha.net/) which displays two distorted images of words from old books. It also adds an angled line, rather than a distorted background and high levels of warping on the text as earlier CAPTCHAs did, because the latter were broken. As a bonus, using reCAPTCHA helps to digitize old books. [ReCAPTCHA](https://github.com/ambethia/recaptcha/) is also a Rails plug-in with the same name as the API. You will get two keys from the API, a public and a private key, which you have to put into your Rails environment. After that you can use the recaptcha_tags method in the view, and the verify_recaptcha method in the controller. Verify_recaptcha will return false if the validation fails. The problem with CAPTCHAs is, they are annoying. Additionally, some visually impaired users have found certain kinds of distorted CAPTCHAs difficult to read. The idea of negative CAPTCHAs is not to ask a user to proof that he is human, but reveal that a spam robot is a bot. -- cgit v1.2.3 From d083193c994b4cf3d52b45fd1c054368bf3a8211 Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Wed, 27 Mar 2013 23:28:36 -0300 Subject: Extraneous syntax on guides path. --- guides/source/ruby_on_rails_guides_guidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/ruby_on_rails_guides_guidelines.md b/guides/source/ruby_on_rails_guides_guidelines.md index a78711f4b2..136dfb4cae 100644 --- a/guides/source/ruby_on_rails_guides_guidelines.md +++ b/guides/source/ruby_on_rails_guides_guidelines.md @@ -65,7 +65,7 @@ HTML Guides ### Generation -To generate all the guides, just `cd` into the **`guides`** directory, run `bundle install` and execute: +To generate all the guides, just `cd` into the `guides` directory, run `bundle install` and execute: ``` bundle exec rake guides:generate -- cgit v1.2.3 From 057ae0b7fc41e617520d665f2d524daff514cb2b Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Wed, 27 Mar 2013 23:30:51 -0300 Subject: Remove unnecessary hyphen. --- guides/source/debugging_rails_applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides') diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md index 5531dee343..4754913f47 100644 --- a/guides/source/debugging_rails_applications.md +++ b/guides/source/debugging_rails_applications.md @@ -23,7 +23,7 @@ One common task is to inspect the contents of a variable. In Rails, you can do t ### `debug` -The `debug` helper will return a \
-tag that renders the object using the YAML format. This will generate human-readable data from any object. For example, if you have this code in a view:
+The `debug` helper will return a \
 tag that renders the object using the YAML format. This will generate human-readable data from any object. For example, if you have this code in a view:
 
 ```html+erb
 <%= debug @post %>
-- 
cgit v1.2.3


From edebf262c41010a77208063848de93ad35de93c9 Mon Sep 17 00:00:00 2001
From: Jonathan Roes 
Date: Wed, 27 Mar 2013 23:41:48 -0300
Subject: Minor proofing

---
 guides/source/debugging_rails_applications.md | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

(limited to 'guides')

diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md
index 4754913f47..6699098e51 100644
--- a/guides/source/debugging_rails_applications.md
+++ b/guides/source/debugging_rails_applications.md
@@ -174,7 +174,7 @@ class PostsController < ApplicationController
 end
 ```
 
-Here's an example of the log generated by this method:
+Here's an example of the log generated when this controller action is executed:
 
 ```
 Processing PostsController#create (for 127.0.0.1 at 2008-09-08 11:52:54) [POST]
@@ -194,11 +194,11 @@ Redirected to #
 Completed in 0.01224 (81 reqs/sec) | DB: 0.00044 (3%) | 302 Found [http://localhost/posts]
 ```
 
-Adding extra logging like this makes it easy to search for unexpected or unusual behavior in your logs. If you add extra logging, be sure to make sensible use of log levels, to avoid filling your production logs with useless trivia.
+Adding extra logging like this makes it easy to search for unexpected or unusual behavior in your logs. If you add extra logging, be sure to make sensible use of log levels to avoid filling your production logs with useless trivia.
 
 ### Tagged Logging
 
-When running multi-user, multi-account applications, it’s often useful to be able to filter the logs using some custom rules. `TaggedLogging` in Active Support helps in doing exactly that by stamping log lines with subdomains, request ids, and anything else to aid debugging such applications.
+When running multi-user, multi-account applications, it’s often useful to be able to filter the logs using some custom rules. `TaggedLogging` in ActiveSupport helps in doing exactly that by stamping log lines with subdomains, request ids, and anything else to aid debugging such applications.
 
 ```ruby
 logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
@@ -216,7 +216,7 @@ The debugger can also help you if you want to learn about the Rails source code
 
 ### Setup
 
-Rails uses the `debugger` gem to set breakpoints and step through live code. To install it, just run:
+You can use the `debugger` gem to set breakpoints and step through live code in Rails. To install it, just run:
 
 ```bash
 $ gem install debugger
@@ -235,7 +235,7 @@ class PeopleController < ApplicationController
 end
 ```
 
-If you see the message in the console or logs:
+If you see this message in the console or logs:
 
 ```
 ***** Debugger requested, but was not available: Start server with --debugger to enable *****
@@ -246,12 +246,12 @@ Make sure you have started your web server with the option `--debugger`:
 ```bash
 $ rails server --debugger
 => Booting WEBrick
-=> Rails 3.0.0 application starting on http://0.0.0.0:3000
+=> Rails 3.2.13 application starting on http://0.0.0.0:3000
 => Debugger enabled
 ...
 ```
 
-TIP: In development mode, you can dynamically `require \'debugger\'` instead of restarting the server, if it was started without `--debugger`.
+TIP: In development mode, you can dynamically `require \'debugger\'` instead of restarting the server, even if it was started without `--debugger`.
 
 ### The Shell
 
@@ -266,7 +266,7 @@ For example:
 (rdb:7)
 ```
 
-Now it's time to explore and dig into your application. A good place to start is by asking the debugger for help... so type: `help` (You didn't see that coming, right?)
+Now it's time to explore and dig into your application. A good place to start is by asking the debugger for help. Type: `help`
 
 ```
 (rdb:7) help
@@ -281,7 +281,7 @@ condition  down     finish  list    ps    save     thread  var
 continue   edit     frame   method  putl  set      tmate   where
 ```
 
-TIP: To view the help menu for any command use `help ` in active debug mode. For example: _`help var`_
+TIP: To view the help menu for any command use `help ` at the debugger prompt. For example: _`help var`_
 
 The next command to learn is one of the most useful: `list`. You can abbreviate any debugging command by supplying just enough letters to distinguish them from other commands, so you can also use `l` for the `list` command.
 
@@ -289,7 +289,7 @@ This command shows you where you are in the code by printing 10 lines centered a
 
 ```
 (rdb:7) list
-[1, 10] in /PathToProject/posts_controller.rb
+[1, 10] in /PathTo/project/app/controllers/posts_controller.rb
    1  class PostsController < ApplicationController
    2    # GET /posts
    3    # GET /posts.json
@@ -325,7 +325,7 @@ On the other hand, to see the previous ten lines you should type `list-` (or `l-
 
 ```
 (rdb:7) l-
-[1, 10] in /PathToProject/posts_controller.rb
+[1, 10] in /PathTo/project/app/controllers/posts_controller.rb
    1  class PostsController < ApplicationController
    2    # GET /posts
    3    # GET /posts.json
@@ -343,7 +343,7 @@ Finally, to see where you are in the code again you can type `list=`
 
 ```
 (rdb:7) list=
-[1, 10] in /PathToProject/posts_controller.rb
+[1, 10] in /PathTo/project/app/controllers/posts_controller.rb
    1  class PostsController < ApplicationController
    2    # GET /posts
    3    # GET /posts.json
@@ -502,7 +502,7 @@ TIP: You can use the debugger while using `rails console`. Just remember to `req
 
 ```
 $ rails console
-Loading development environment (Rails 3.1.0)
+Loading development environment (Rails 3.2.13)
 >> require "debugger"
 => []
 >> author = Author.first
-- 
cgit v1.2.3


From 9c6ccb3224b40cefa05f3d14a381150059a87a09 Mon Sep 17 00:00:00 2001
From: Vinicius Quaiato 
Date: Fri, 29 Mar 2013 03:04:50 -0300
Subject: info that Gemfile *group :assets* was removed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Adding info that Gemfile *group :assets* was removed on upgrading_ruby_on_rails.md
---
 guides/source/upgrading_ruby_on_rails.md | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

(limited to 'guides')

diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index 535d536dea..62e2624434 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -31,6 +31,32 @@ If your application is currently on any version of Rails older than 3.2.x, you s
 
 The following changes are meant for upgrading your application to Rails 4.0.
 
+### Gemfile
+
+Rails 4.0 removed the *group :assets* from Gemfile (now you can use only :test, :development and/or :production groups). So change your Gemfile from:
+```ruby
+group :assets do
+  gem 'sass-rails',   '~> 4.0.0.beta1'
+  gem 'coffee-rails', '~> 4.0.0.beta1'
+
+  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+  # gem 'therubyracer', platforms: :ruby
+
+  gem 'uglifier', '>= 1.0.3'
+end
+```
+to:
+```ruby
+gem 'sass-rails',   '~> 4.0.0.beta1'
+gem 'coffee-rails', '~> 4.0.0.beta1'
+
+# See https://github.com/sstephenson/execjs#readme for more supported runtimes
+# gem 'therubyracer', platforms: :ruby
+
+gem 'uglifier', '>= 1.0.3'
+```
+**note:** don't removing the *group assets* from the Gemfile will cause your assets stop compiling
+
 ### vendor/plugins
 
 Rails 4.0 no longer supports loading plugins from `vendor/plugins`. You must replace any plugins by extracting them to gems and adding them to your Gemfile. If you choose not to make them gems, you can move them into, say, `lib/my_plugin/*` and add an appropriate initializer in `config/initializers/my_plugin.rb`.
-- 
cgit v1.2.3


From 8fcc1bed044d344e64ea340901d4740c9696b338 Mon Sep 17 00:00:00 2001
From: Jonathan Roes 
Date: Fri, 29 Mar 2013 19:43:10 -0300
Subject: Proofreading tweaks

- Consistent hash structure
- Rewording / typo fixes
---
 guides/source/action_controller_overview.md | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'guides')

diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 55aab1ef93..c2bb2f317f 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -39,7 +39,7 @@ class ClientsController < ApplicationController
 end
 ```
 
-As an example, if a user goes to `/clients/new` in your application to add a new client, Rails will create an instance of `ClientsController` and run the `new` method. Note that the empty method from the example above could work just fine because Rails will by default render the `new.html.erb` view unless the action says otherwise. The `new` method could make available to the view a `@client` instance variable by creating a new `Client`:
+As an example, if a user goes to `/clients/new` in your application to add a new client, Rails will create an instance of `ClientsController` and run the `new` method. Note that the empty method from the example above would work just fine because Rails will by default render the `new.html.erb` view unless the action says otherwise. The `new` method could make available to the view a `@client` instance variable by creating a new `Client`:
 
 ```ruby
 def new
@@ -113,21 +113,21 @@ To send a hash you include the key name inside the brackets:
 
 ```
 
-When this form is submitted, the value of `params[:client]` will be `{"name" => "Acme", "phone" => "12345", "address" => {"postcode" => "12345", "city" => "Carrot City"}}`. Note the nested hash in `params[:client][:address]`.
+When this form is submitted, the value of `params[:client]` will be `{ "name" => "Acme", "phone" => "12345", "address" => { "postcode" => "12345", "city" => "Carrot City" } }`. Note the nested hash in `params[:client][:address]`.
 
-Note that the `params` hash is actually an instance of `ActiveSupport::HashWithIndifferentAccess`, which acts like a hash that lets you use symbols and strings interchangeably as keys.
+Note that the `params` hash is actually an instance of `ActiveSupport::HashWithIndifferentAccess`, which acts like a hash but lets you use symbols and strings interchangeably as keys.
 
 ### JSON parameters
 
-If you're writing a web service application, you might find yourself more comfortable on accepting parameters in JSON format. Rails will automatically convert your parameters into `params` hash, which you'll be able to access like you would normally do with form data.
+If you're writing a web service application, you might find yourself more comfortable accepting parameters in JSON format. Rails will automatically convert your parameters into the `params` hash, which you can access as you would normally.
 
-So for example, if you are sending this JSON parameter:
+So for example, if you are sending this JSON content:
 
 ```json
 { "company": { "name": "acme", "address": "123 Carrot Street" } }
 ```
 
-You'll get `params[:company]` as `{ :name => "acme", "address" => "123 Carrot Street" }`.
+You'll get `params[:company]` as `{ "name" => "acme", "address" => "123 Carrot Street" }`.
 
 Also, if you've turned on `config.wrap_parameters` in your initializer or calling `wrap_parameters` in your controller, you can safely omit the root element in the JSON parameter. The parameters will be cloned and wrapped in the key according to your controller's name by default. So the above parameter can be written as:
 
@@ -143,7 +143,7 @@ And assume that you're sending the data to `CompaniesController`, it would then
 
 You can customize the name of the key or specific parameters you want to wrap by consulting the [API documentation](http://api.rubyonrails.org/classes/ActionController/ParamsWrapper.html)
 
-NOTE: A support for parsing XML parameters has been extracted into a gem named `actionpack-xml_parser`
+NOTE: Support for parsing XML parameters has been extracted into a gem named `actionpack-xml_parser`
 
 ### Routing Parameters
 
-- 
cgit v1.2.3


From 6bd1bbe7cf87ae2b4764e0ed0d5b583bd026af8a Mon Sep 17 00:00:00 2001
From: Jonathan Roes 
Date: Fri, 29 Mar 2013 19:53:34 -0300
Subject: More typo / wording fixes

---
 guides/source/action_controller_overview.md | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'guides')

diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index c2bb2f317f..403b22852b 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -138,7 +138,7 @@ Also, if you've turned on `config.wrap_parameters` in your initializer or callin
 And assume that you're sending the data to `CompaniesController`, it would then be wrapped in `:company` key like this:
 
 ```ruby
-{ :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" }}
+{ :name => "acme", :address => "123 Carrot Street", :company => { :name => "acme", :address => "123 Carrot Street" } }
 ```
 
 You can customize the name of the key or specific parameters you want to wrap by consulting the [API documentation](http://api.rubyonrails.org/classes/ActionController/ParamsWrapper.html)
@@ -150,7 +150,7 @@ NOTE: Support for parsing XML parameters has been extracted into a gem named `ac
 The `params` hash will always contain the `:controller` and `:action` keys, but you should use the methods `controller_name` and `action_name` instead to access these values. Any other parameters defined by the routing, such as `:id` will also be available. As an example, consider a listing of clients where the list can show either active or inactive clients. We can add a route which captures the `:status` parameter in a "pretty" URL:
 
 ```ruby
-match '/clients/:status' => 'clients#index', foo: "bar"
+match '/clients/:status' => 'clients#index', foo: 'bar'
 ```
 
 In this case, when a user opens the URL `/clients/active`, `params[:status]` will be set to "active". When this route is used, `params[:foo]` will also be set to "bar" just like it was passed in the query string. In the same way `params[:action]` will contain "index".
@@ -173,7 +173,7 @@ If you define `default_url_options` in `ApplicationController`, as in the exampl
 
 ### Strong Parameters
 
-With strong parameters Action Controller parameters are forbidden to
+With strong parameters, Action Controller parameters are forbidden to
 be used in Active Model mass assignments until they have been
 whitelisted. This means you'll have to make a conscious choice about
 which attributes to allow for mass updating and thus prevent
@@ -273,7 +273,7 @@ to having a `name` (any permitted scalar values allowed, too).
 
 You want to also use the permitted attributes in the `new`
 action. This raises the problem that you can't use `require` on the
-root-key because normally it does not exist when calling `new`:
+root key because normally it does not exist when calling `new`:
 
 ```ruby
 # using `fetch` you can supply a default and use
@@ -291,7 +291,7 @@ params.require(:author).permit(:name, books_attributes: [:title, :id, :_destroy]
 ```
 
 Hashes with integer keys are treated differently and you can declare
-the attributes as if they were direct children. You get this kind of
+the attributes as if they were direct children. You get these kinds of
 parameters when you use `accepts_nested_attributes_for` in combination
 with a `has_many` association:
 
@@ -311,7 +311,7 @@ in mind. It is not meant as a silver bullet to handle all your
 whitelisting problems. However you can easily mix the API with your
 own code to adapt to your situation.
 
-Imagine a situation where you want to whitelist an attribute
+Imagine a scenario where you want to whitelist an attribute
 containing a hash with any keys. Using strong parameters you can't
 allow a hash with any keys but you can use a simple assignment to get
 the job done:
-- 
cgit v1.2.3