From d5c7257e75ba0d0fdd356fdb12e4be18e4701a30 Mon Sep 17 00:00:00 2001 From: capps Date: Mon, 11 Mar 2013 08:10:43 -0700 Subject: [PATCH 01/64] 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(-) 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 From 402a89903396ea97a0a1fc0e6c67c5dfb047d05b Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Mon, 11 Mar 2013 16:41:29 -0400 Subject: [PATCH 02/64] Minor copy editing --- activerecord/lib/active_record/associations.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 5b6f885122..5613c54f0b 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1114,11 +1114,11 @@ module ActiveRecord # similar callbacks may affect the :dependent behavior, and the # :dependent behavior may affect other callbacks. # - # * :destroy causes all the associated objects to also be destroyed - # * :delete_all causes all the associated objects to be deleted directly from the database (so callbacks will not execute) + # * :destroy causes all the associated objects to also be destroyed. + # * :delete_all causes all the associated objects to be deleted directly from the database (so callbacks will not be executed). # * :nullify causes the foreign keys to be set to +NULL+. Callbacks are not executed. - # * :restrict_with_exception causes an exception to be raised if there are any associated records - # * :restrict_with_error causes an error to be added to the owner if there are any associated objects + # * :restrict_with_exception causes an exception to be raised if there are any associated records. + # * :restrict_with_error causes an error to be added to the owner if there are any associated objects. # # If using with the :through option, the association on the join model must be # a +belongs_to+, and the records which get deleted are the join records, rather than From dbafd36a2dd5751b6138b180474f81faad6dc46f Mon Sep 17 00:00:00 2001 From: Waynn Lue Date: Mon, 11 Mar 2013 15:41:44 -0700 Subject: [PATCH 03/64] update README since email-service isn't a word --- actionmailer/README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 9feb2add5b..7e684afe42 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -1,6 +1,6 @@ = Action Mailer -- Easy email delivery and testing -Action Mailer is a framework for designing email-service layers. These layers +Action Mailer is a framework for designing email service layers. These layers are used to consolidate code for sending out forgotten passwords, welcome wishes on signup, invoices for billing, and any other use case that requires a written notification to either a person or another system. From 672ffd4cd498eca36db3c3c495e955afde0f9258 Mon Sep 17 00:00:00 2001 From: Daniel Lobato Date: Tue, 12 Mar 2013 11:11:43 +0100 Subject: [PATCH 04/64] Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT field' is the only pluck query that translates into the aforementioned SQL --- activerecord/lib/active_record/relation/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 7f95181c67..d24f8233a8 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -135,7 +135,7 @@ module ActiveRecord # # SELECT people.id, people.name FROM people # # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']] # - # Person.uniq.pluck(:role) + # Person.pluck('DISTINCT role') # # SELECT DISTINCT role FROM people # # => ['admin', 'member', 'guest'] # From 99c741e35ba4cefc8883681f2363092cb8f0723e Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Tue, 12 Mar 2013 17:21:39 +0100 Subject: [PATCH 05/64] Document nested attributes as hash of hashes Document the possibility to use a hash of hashes for nested attributes for a one-to-many association (in addition to the documented possibility to use an array of hashes). --- .../lib/active_record/nested_attributes.rb | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 602ab9e2f4..d5b51ecedf 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -90,8 +90,9 @@ module ActiveRecord # accepts_nested_attributes_for :posts # end # - # You can now set or update attributes on an associated post model through - # the attribute hash. + # You can now set or update attributes on the associated posts through + # an attribute hash for a member: include the key +:posts_attributes+ + # with an array of hashes of post attributes as a value. # # For each hash that does _not_ have an id key a new record will # be instantiated, unless the hash also contains a _destroy key @@ -183,6 +184,29 @@ module ActiveRecord # member.save # member.reload.posts.length # => 1 # + # Nested attributes for an associated collection can also be passed in + # the form of a hash of hashes instead of an array of hashes: + # + # Member.create(name: 'joe', + # posts_attributes: { first: { title: 'Foo' }, + # second: { title: 'Bar' } }) + # + # has the same effect as + # + # Member.create(name: 'joe', + # posts_attributes: [ { title: 'Foo' }, + # { title: 'Bar' } ]) + # + # The keys of the hash which is the value for +:posts_attributes+ are + # ignores in this case. + # However, it is not allowed to use +'id'+ or +:id+ for one of + # such keys, otherwise the hash will be wrapped in an array and + # interpreted as an attribute hash for a single post. + # + # Passing attributes for an associated collection in the form of a hash + # of hashes can be used with hashes generated from HTTP/HTML parameters, + # where there maybe no natural way to submit an array of hashes. + # # === Saving # # All changes to models, including the destruction of those marked for From b6cf11138c99093cb4c2c8e997355ca4a8f80b6a Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Tue, 12 Mar 2013 17:22:07 +0100 Subject: [PATCH 06/64] Align indentation in comments --- .../lib/active_record/nested_attributes.rb | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index d5b51ecedf..abf8272775 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -115,10 +115,10 @@ module ActiveRecord # hashes if they fail to pass your criteria. For example, the previous # example could be rewritten as: # - # class Member < ActiveRecord::Base - # has_many :posts - # accepts_nested_attributes_for :posts, reject_if: proc { |attributes| attributes['title'].blank? } - # end + # class Member < ActiveRecord::Base + # has_many :posts + # accepts_nested_attributes_for :posts, reject_if: proc { |attributes| attributes['title'].blank? } + # end # # params = { member: { # name: 'joe', posts_attributes: [ @@ -135,19 +135,19 @@ module ActiveRecord # # Alternatively, :reject_if also accepts a symbol for using methods: # - # class Member < ActiveRecord::Base - # has_many :posts - # accepts_nested_attributes_for :posts, reject_if: :new_record? - # end + # class Member < ActiveRecord::Base + # has_many :posts + # accepts_nested_attributes_for :posts, reject_if: :new_record? + # end # - # class Member < ActiveRecord::Base - # has_many :posts - # accepts_nested_attributes_for :posts, reject_if: :reject_posts + # class Member < ActiveRecord::Base + # has_many :posts + # accepts_nested_attributes_for :posts, reject_if: :reject_posts # - # def reject_posts(attributed) - # attributed['title'].blank? - # end - # end + # def reject_posts(attributed) + # attributed['title'].blank? + # end + # end # # If the hash contains an id key that matches an already # associated record, the matching record will be modified: From 694c9ed6c383f9b0d7e510f9e9b0a5491636e032 Mon Sep 17 00:00:00 2001 From: Alexey Muranov Date: Tue, 12 Mar 2013 18:02:00 +0100 Subject: [PATCH 07/64] Fix my typo --- activerecord/lib/active_record/nested_attributes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index abf8272775..f0c29bbf73 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -198,7 +198,7 @@ module ActiveRecord # { title: 'Bar' } ]) # # The keys of the hash which is the value for +:posts_attributes+ are - # ignores in this case. + # ignored in this case. # However, it is not allowed to use +'id'+ or +:id+ for one of # such keys, otherwise the hash will be wrapped in an array and # interpreted as an attribute hash for a single post. From 680fab830898b56d70792d1f708a1bb3bac2b33a Mon Sep 17 00:00:00 2001 From: Patrick Helm Date: Tue, 12 Mar 2013 18:18:09 +0100 Subject: [PATCH 08/64] Fix missing closing tag --- railties/lib/rails/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 579af8c6a5..93504b3b35 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -107,7 +107,7 @@ module Rails # # The Application class adds a couple more paths to this set. And as in your # Application, all folders under +app+ are automatically added to the load path. - # If you have an app/services/tt> folder for example, it will be added by default. + # If you have an app/services folder for example, it will be added by default. # # == Endpoint # From 008fd54e74aa01e590074861fd2e6d82bed82af8 Mon Sep 17 00:00:00 2001 From: Waynn Lue Date: Tue, 12 Mar 2013 18:44:10 -0700 Subject: [PATCH 09/64] clarify verbiage --- activemodel/README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activemodel/README.rdoc b/activemodel/README.rdoc index 1b1fe2fa2b..a66225319d 100644 --- a/activemodel/README.rdoc +++ b/activemodel/README.rdoc @@ -2,7 +2,7 @@ Active Model provides a known set of interfaces for usage in model classes. They allow for Action Pack helpers to interact with non-Active Record models, -for example. Active Model also helps building custom ORMs for use outside of +for example. Active Model also helps with building custom ORMs for use outside of the Rails framework. Prior to Rails 3.0, if a plugin or gem developer wanted to have an object From 8b3483f0a8144d0093108acc28d50814076dcf73 Mon Sep 17 00:00:00 2001 From: Angelo capilleri Date: Wed, 13 Mar 2013 14:11:46 +0100 Subject: [PATCH 10/64] absence validator doc --- guides/source/active_record_validations.md | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) 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 From 74c3b7f6f61c1115b7409cb8ce9d6832ef9caa75 Mon Sep 17 00:00:00 2001 From: Angelo capilleri Date: Wed, 13 Mar 2013 14:18:37 +0100 Subject: [PATCH 11/64] fix absence validator doc for boolean field --- guides/source/active_record_validations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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"_. From e23413bfcae72f52258658e1b5ba1f061467077d Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 14 Mar 2013 02:02:56 +0530 Subject: [PATCH 12/64] fix missing to --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From d41c279bf12de4722d4cf781929e491e588a612c Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 14 Mar 2013 10:12:54 +0530 Subject: [PATCH 13/64] 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(-) 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: From c9f75463bff73930210097fbe7ed9a029f5fce8d Mon Sep 17 00:00:00 2001 From: Waynn Lue Date: Thu, 14 Mar 2013 18:03:17 -0700 Subject: [PATCH 14/64] make the headers consistent --- activerecord/README.rdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc index ed1e171d58..822e460918 100644 --- a/activerecord/README.rdoc +++ b/activerecord/README.rdoc @@ -190,7 +190,7 @@ The latest version of Active Record can be installed with RubyGems: % [sudo] gem install activerecord -Source code can be downloaded as part of the Rails project on GitHub +Source code can be downloaded as part of the Rails project on GitHub: * https://github.com/rails/rails/tree/master/activerecord @@ -204,7 +204,7 @@ Active Record is released under the MIT license: == Support -API documentation is at +API documentation is at: * http://api.rubyonrails.org From 6e0aafbba2300e78ecb8bf956dd5e90b6acf6b94 Mon Sep 17 00:00:00 2001 From: Limon Lin Date: Fri, 15 Mar 2013 13:14:26 +0800 Subject: [PATCH 15/64] 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(-) 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]) From aec466e75294be177f66472fcdbd392831b26fdd Mon Sep 17 00:00:00 2001 From: Tim Lowrimore Date: Fri, 15 Mar 2013 12:36:16 -0500 Subject: [PATCH 16/64] 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(-) 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 From e42d60780df2764301c4417c91512ca94d97c38c Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Fri, 15 Mar 2013 19:28:43 +0100 Subject: [PATCH 17/64] Unmatched parenthesis fix --- .../connection_adapters/abstract/schema_statements.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb index e2deb6bfcd..c1f3462bbe 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -39,7 +39,7 @@ module ActiveRecord # index_exists?(:suppliers, :company_id, unique: true) # # # Check an index with a custom name exists - # index_exists?(:suppliers, :company_id, name: "idx_company_id" + # index_exists?(:suppliers, :company_id, name: "idx_company_id") def index_exists?(table_name, column_name, options = {}) column_names = Array(column_name) index_name = options.key?(:name) ? options[:name].to_s : index_name(table_name, :column => column_names) From 0ddae9fcf6a648b48cf06562a95618ea6c84fbbb Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Fri, 15 Mar 2013 22:48:41 +0300 Subject: [PATCH 18/64] fix typo in form helpers guide --- guides/source/form_helpers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: From 3aa3880cfb86d7330db573a31066fd8ef897f180 Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sat, 16 Mar 2013 01:02:21 +0300 Subject: [PATCH 19/64] fix markup of controllers guide --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 65d681f5e351fa7c7d117ecebe8b7a95f9ebea8d Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sat, 16 Mar 2013 01:14:54 +0300 Subject: [PATCH 20/64] Update action_controller_overview.md --- guides/source/action_controller_overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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! From 79af9e938f0265af748cca8816137536e0c723a6 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Fri, 15 Mar 2013 19:20:53 -0500 Subject: [PATCH 21/64] nodoc AR::ConnectionHandling for adapters [ci skip] --- .../connection_adapters/mysql2_adapter.rb | 2 +- .../active_record/connection_adapters/mysql_adapter.rb | 4 ++-- .../connection_adapters/postgresql_adapter.rb | 4 ++-- .../connection_adapters/sqlite3_adapter.rb | 4 ++-- activerecord/lib/active_record/connection_handling.rb | 10 +++++----- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index 20a5ca2baa..99ea1ee0ca 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -4,7 +4,7 @@ gem 'mysql2', '~> 0.3.10' require 'mysql2' module ActiveRecord - module ConnectionHandling + module ConnectionHandling # :nodoc: # Establishes a connection to the database that's used by all Active Record objects. def mysql2_connection(config) config = config.symbolize_keys diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index 7544c2a783..c836c5d8e8 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -16,9 +16,9 @@ class Mysql end module ActiveRecord - module ConnectionHandling + module ConnectionHandling # :nodoc: # Establishes a connection to the database that's used by all Active Record objects. - def mysql_connection(config) # :nodoc: + def mysql_connection(config) config = config.symbolize_keys host = config[:host] port = config[:port] diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 691b2ab37f..2115d960fa 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -16,7 +16,7 @@ require 'pg' require 'ipaddr' module ActiveRecord - module ConnectionHandling + module ConnectionHandling # :nodoc: VALID_CONN_PARAMS = [:host, :hostaddr, :port, :dbname, :user, :password, :connect_timeout, :client_encoding, :options, :application_name, :fallback_application_name, :keepalives, :keepalives_idle, :keepalives_interval, :keepalives_count, @@ -24,7 +24,7 @@ module ActiveRecord :requirepeer, :krbsrvname, :gsslib, :service] # Establishes a connection to the database that's used by all Active Record objects - def postgresql_connection(config) # :nodoc: + def postgresql_connection(config) conn_params = config.symbolize_keys conn_params.delete_if { |_, v| v.nil? } diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 84fa1c7d5a..49966678d6 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -6,9 +6,9 @@ gem 'sqlite3', '~> 1.3.6' require 'sqlite3' module ActiveRecord - module ConnectionHandling + module ConnectionHandling # :nodoc: # sqlite3 adapter reuses sqlite_connection. - def sqlite3_connection(config) # :nodoc: + def sqlite3_connection(config) # Require database. unless config[:database] raise ArgumentError, "No database file specified. Missing argument: database" diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index d6d998c7be..1e03414c29 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -15,15 +15,15 @@ module ActiveRecord # Example for SQLite database: # # ActiveRecord::Base.establish_connection( - # adapter: "sqlite", - # database: "path/to/dbfile" + # adapter: "sqlite", + # database: "path/to/dbfile" # ) # # Also accepts keys as strings (for parsing from YAML for example): # # ActiveRecord::Base.establish_connection( - # "adapter" => "sqlite", - # "database" => "path/to/dbfile" + # "adapter" => "sqlite", + # "database" => "path/to/dbfile" # ) # # Or a URL: @@ -79,7 +79,7 @@ module ActiveRecord connection_handler.retrieve_connection(self) end - # Returns true if Active Record is connected. + # Returns +true+ if Active Record is connected. def connected? connection_handler.connected?(self) end From 387928c2348880c5801b422805a069e7c4910289 Mon Sep 17 00:00:00 2001 From: Mikhail Dieterle Date: Sat, 16 Mar 2013 11:08:01 +0300 Subject: [PATCH 22/64] Capitalize first letter in sentence --- guides/source/routing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From fa63f83fd42bece15d06bbe77b6b717ebee5c188 Mon Sep 17 00:00:00 2001 From: Bryan Ricker Date: Sat, 16 Mar 2013 15:21:42 -0700 Subject: [PATCH 23/64] Remove :all from *args options in AbstractController.helper --- actionpack/lib/abstract_controller/helpers.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index 812a35735f..bb701184e8 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -59,7 +59,7 @@ module AbstractController # The +helper+ class method can take a series of helper module names, a block, or both. # # ==== Options - # * *args - Module, Symbol, String, :all + # * *args - Module, Symbol, String # * block - A block defining helper methods # # When the argument is a module it will be included directly in the template class. From 396bb77199883773c8ce9ef53365a8fc0cac37f8 Mon Sep 17 00:00:00 2001 From: Tatsuro Baba Date: Mon, 18 Mar 2013 18:31:24 +0900 Subject: [PATCH 24/64] Capitalize the first letter of sentence --- actionpack/lib/abstract_controller/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index 56dc9ab7a1..af5de815bb 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -35,7 +35,7 @@ module AbstractController end def inherited(klass) # :nodoc: - # define the abstract ivar on subclasses so that we don't get + # Define the abstract ivar on subclasses so that we don't get # uninitialized ivar warnings unless klass.instance_variable_defined?(:@abstract) klass.instance_variable_set(:@abstract, false) From efea57a33b9407e2bdb693827e57e096ed1d957e Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Mon, 18 Mar 2013 06:21:38 -0500 Subject: [PATCH 25/64] Using match without via is deprecated --- actionpack/lib/action_dispatch/routing.rb | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index d55eb8109a..b896ec9efb 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -78,7 +78,7 @@ module ActionDispatch # Example: # # # In routes.rb - # match '/login' => 'accounts#login', as: 'login' + # get '/login' => 'accounts#login', as: 'login' # # # With render, redirect_to, tests, etc. # redirect_to login_url @@ -104,9 +104,9 @@ module ActionDispatch # # # In routes.rb # controller :blog do - # match 'blog/show' => :list - # match 'blog/delete' => :delete - # match 'blog/edit/:id' => :edit + # get 'blog/show' => :list + # get 'blog/delete' => :delete + # get 'blog/edit/:id' => :edit # end # # # provides named routes for show, delete, and edit @@ -116,7 +116,7 @@ module ActionDispatch # # Routes can generate pretty URLs. For example: # - # match '/articles/:year/:month/:day' => 'articles#find_by_id', constraints: { + # get '/articles/:year/:month/:day' => 'articles#find_by_id', constraints: { # year: /\d{4}/, # month: /\d{1,2}/, # day: /\d{1,2}/ @@ -131,7 +131,7 @@ module ActionDispatch # You can specify a regular expression to define a format for a parameter. # # controller 'geocode' do - # match 'geocode/:postalcode' => :show, constraints: { + # get 'geocode/:postalcode' => :show, constraints: { # postalcode: /\d{5}(-\d{4})?/ # } # @@ -139,13 +139,13 @@ module ActionDispatch # expression modifiers: # # controller 'geocode' do - # match 'geocode/:postalcode' => :show, constraints: { + # get 'geocode/:postalcode' => :show, constraints: { # postalcode: /hx\d\d\s\d[a-z]{2}/i # } # end # # controller 'geocode' do - # match 'geocode/:postalcode' => :show, constraints: { + # get 'geocode/:postalcode' => :show, constraints: { # postalcode: /# Postcode format # \d{5} #Prefix # (-\d{4})? #Suffix @@ -153,7 +153,7 @@ module ActionDispatch # } # end # - # Using the multiline match modifier will raise an +ArgumentError+. + # Using the multiline modifier will raise an +ArgumentError+. # Encoding regular expression modifiers are silently ignored. The # match will always use the default encoding or ASCII. # @@ -213,13 +213,13 @@ module ActionDispatch # # You can redirect any path to another path using the redirect helper in your router: # - # match "/stories" => redirect("/posts") + # get "/stories" => redirect("/posts") # # == Unicode character routes # # You can specify unicode character routes in your router: # - # match "こんにちは" => "welcome#index" + # get "こんにちは" => "welcome#index" # # == Routing to Rack Applications # @@ -227,7 +227,7 @@ module ActionDispatch # index action in the PostsController, you can specify any Rack application # as the endpoint for a matcher: # - # match "/application.js" => Sprockets + # get "/application.js" => Sprockets # # == Reloading routes # From 70ff81075debca07ae7d32ae45bfbfe4bddc1cf7 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Mon, 18 Mar 2013 06:22:08 -0500 Subject: [PATCH 26/64] The default route has been removed --- actionpack/lib/action_dispatch/routing.rb | 24 ----------------------- 1 file changed, 24 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index b896ec9efb..8881417583 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -157,30 +157,6 @@ module ActionDispatch # Encoding regular expression modifiers are silently ignored. The # match will always use the default encoding or ASCII. # - # == Default route - # - # Consider the following route, which you will find commented out at the - # bottom of your generated config/routes.rb: - # - # match ':controller(/:action(/:id))(.:format)' - # - # This route states that it expects requests to consist of a - # :controller followed optionally by an :action that in - # turn is followed optionally by an :id, which in turn is followed - # optionally by a :format. - # - # Suppose you get an incoming request for /blog/edit/22, you'll end - # up with: - # - # params = { controller: 'blog', - # action: 'edit', - # id: '22' - # } - # - # By not relying on default routes, you improve the security of your - # application since not all controller actions, which includes actions you - # might add at a later time, are exposed by default. - # # == HTTP Methods # # Using the :via option when specifying a route allows you to From 7305ef842b675bf965f063de681a96294577fb84 Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Mon, 18 Mar 2013 06:35:19 -0500 Subject: [PATCH 27/64] The HTTP method helpers are preferred over match and should be explained before named routes --- actionpack/lib/action_dispatch/routing.rb | 44 +++++++++-------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb index 8881417583..550c7d0e7b 100644 --- a/actionpack/lib/action_dispatch/routing.rb +++ b/actionpack/lib/action_dispatch/routing.rb @@ -69,6 +69,22 @@ module ActionDispatch # Routing::Mapper::Scoping#namespace, and # Routing::Mapper::Scoping#scope. # + # == Non-resourceful routes + # + # For routes that don't fit the resources mold, you can use the HTTP helper + # methods get, post, patch, put and delete. + # + # get 'post/:id' => 'posts#show' + # post 'post/:id' => 'posts#create_comment' + # + # If your route needs to respond to more than one HTTP method (or all methods) then using the + # :via option on match is preferable. + # + # match 'post/:id' => 'posts#show', via: [:get, :post] + # + # Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same + # URL will route to the show action. + # # == Named routes # # Routes can be named by passing an :as option, @@ -157,34 +173,6 @@ module ActionDispatch # Encoding regular expression modifiers are silently ignored. The # match will always use the default encoding or ASCII. # - # == HTTP Methods - # - # Using the :via option when specifying a route allows you to - # restrict it to a specific HTTP method. Possible values are :post, - # :get, :patch, :put, :delete and - # :any. If your route needs to respond to more than one method you - # can use an array, e.g. [ :get, :post ]. The default value is - # :any which means that the route will respond to any of the HTTP - # methods. - # - # match 'post/:id' => 'posts#show', via: :get - # match 'post/:id' => 'posts#create_comment', via: :post - # - # Now, if you POST to /posts/:id, it will route to the create_comment action. A GET on the same - # URL will route to the show action. - # - # === HTTP helper methods - # - # An alternative method of specifying which HTTP method a route should respond to is to use the helper - # methods get, post, patch, put and delete. - # - # get 'post/:id' => 'posts#show' - # post 'post/:id' => 'posts#create_comment' - # - # This syntax is less verbose and the intention is more apparent to someone else reading your code, - # however if your route needs to respond to more than one HTTP method (or all methods) then using the - # :via option on match is preferable. - # # == External redirects # # You can redirect any path to another path using the redirect helper in your router: From 455948c5080031811f11dcc075095a2bb650e61b Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Mon, 18 Mar 2013 06:38:10 -0500 Subject: [PATCH 28/64] The default route has been removed --- guides/source/routing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))' From b5c6a9e5287584a73958e00184d55ed4638f36ac Mon Sep 17 00:00:00 2001 From: Carson McDonald Date: Mon, 18 Mar 2013 09:27:23 -0400 Subject: [PATCH 29/64] Fix typo, ording to ordering [ci skip] --- activerecord/lib/active_record/relation/finder_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 14520381c9..e2685d0478 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -37,7 +37,7 @@ module ActiveRecord end # Finds the first record matching the specified conditions. There - # is no implied ording so if order matters, you should specify it + # is no implied ordering so if order matters, you should specify it # yourself. # # If no record is found, returns nil. From f1563f4226a6c7b041e55f8569b2aaccf721b23d Mon Sep 17 00:00:00 2001 From: Waynn Lue Date: Mon, 18 Mar 2013 15:47:41 -0700 Subject: [PATCH 30/64] "overwritten" is one word --- actionmailer/README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 7e684afe42..4d78d6142a 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -78,7 +78,7 @@ Or you can just chain the methods together like: It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method default which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like :from as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally, it is also possible to pass in a Proc that will get evaluated when it is needed. -Note that every value you set with this method will get over written if you use the same key in your mailer method. +Note that every value you set with this method will get overwritten if you use the same key in your mailer method. Example: From cf0931166be13dbbe660fece78531060fa16be29 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Tue, 19 Mar 2013 23:10:54 +0530 Subject: [PATCH 31/64] Fixed small typos --- actionpack/lib/action_dispatch/http/upload.rb | 2 +- actionpack/lib/action_dispatch/middleware/cookies.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb index 67cb7fbcb5..b4df2b691f 100644 --- a/actionpack/lib/action_dispatch/http/upload.rb +++ b/actionpack/lib/action_dispatch/http/upload.rb @@ -6,7 +6,7 @@ module ActionDispatch # of its interface is available directly for convenience. # # Uploaded files are temporary files whose lifespan is one request. When - # the object is finalized Ruby unlinks the file, so there is not need to + # the object is finalized Ruby unlinks the file, so there is no need to # clean them with a separate maintenance task. class UploadedFile # The basename of the file in the client. diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 36a0db6e61..0675289980 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -10,7 +10,7 @@ module ActionDispatch end end - # \Cookies are read and written through ActionController#cookies. + # Cookies are read and written through ActionController#cookies. # # The cookies being read are the ones received along with the request, the cookies # being written will be sent out with the response. Reading a cookie does not get From 428ff5a896da24490522040a947d7b7c369855c7 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Wed, 20 Mar 2013 01:23:34 +0530 Subject: [PATCH 32/64] more typos in guides --- guides/source/asset_pipeline.md | 2 +- guides/source/form_helpers.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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: From 61cd377a64a09c359bb979ed6c141519999a3632 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Tue, 19 Mar 2013 13:04:02 -0700 Subject: [PATCH 33/64] Undo bad change in cf0931166be13dbbe660 I didn't know that this was about RDoc! --- actionpack/lib/action_dispatch/middleware/cookies.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 0675289980..36a0db6e61 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -10,7 +10,7 @@ module ActionDispatch end end - # Cookies are read and written through ActionController#cookies. + # \Cookies are read and written through ActionController#cookies. # # The cookies being read are the ones received along with the request, the cookies # being written will be sent out with the response. Reading a cookie does not get From 926357040b7c5e19efb3bd1b51338621577d0138 Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Wed, 20 Mar 2013 01:50:53 +0530 Subject: [PATCH 34/64] 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(-) 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: From 5dfaf8b5b5d6175fc6dc1992f47f6ac740bdc011 Mon Sep 17 00:00:00 2001 From: Ryan Sandridge Date: Tue, 19 Mar 2013 18:05:44 -0400 Subject: [PATCH 35/64] 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(-) 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 -------- From b9b8b240098eec098904cf084f751f8bf8cc7bcc Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Thu, 21 Mar 2013 20:37:09 +0530 Subject: [PATCH 36/64] Added link to Turbolinks Railscast --- guides/source/working_with_javascript_in_rails.md | 1 + 1 file changed, 1 insertion(+) 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 From 573df1cf2a5d5d1f288c8a4a5d76194675141832 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Thu, 21 Mar 2013 20:41:45 +0530 Subject: [PATCH 37/64] Using American English spellings over British style spellings --- activesupport/CHANGELOG.md | 6 +++--- guides/source/upgrading_ruby_on_rails.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 9d26b8ba3e..f5042ed170 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -74,7 +74,7 @@ * Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset* -* Standardise on `to_time` returning an instance of `Time` in the local system timezone +* Standardize on `to_time` returning an instance of `Time` in the local system timezone across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`. *Andrew White* @@ -140,7 +140,7 @@ * Remove surrogate unicode character encoding from `ActiveSupport::JSON.encode` The encoding scheme was broken for unicode characters outside the basic multilingual plane; - since json is assumed to be UTF-8, and we already force the encoding to UTF-8, + since JSON is assumed to be UTF-8, and we already force the encoding to UTF-8, simply pass through the un-encoded characters. *Brett Carter* @@ -359,7 +359,7 @@ * An optional block can be passed to `HashWithIndifferentAccess#update` and `#merge`. The block will be invoked for each duplicated key, and used to resolve the conflict, - thus replicating the behaviour of the corresponding methods on the `Hash` class. + thus replicating the behavior of the corresponding methods on the `Hash` class. *Leo Cassarani* 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 From 6f9baaec790a59eed3813731c54e43a22795a04b Mon Sep 17 00:00:00 2001 From: ma2gedev Date: Fri, 22 Mar 2013 00:52:37 +0900 Subject: [PATCH 38/64] Remove duplicated accepts_nested_attributes description there are just the same description about accepts_nested_attributes [ci skip] --- .../lib/action_view/helpers/form_helper.rb | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 3dae1fc87a..ec89da71a1 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -655,14 +655,6 @@ module ActionView # ... # <% end %> # - # When projects is already an association on Person you can use - # +accepts_nested_attributes_for+ to define the writer method for you: - # - # class Person < ActiveRecord::Base - # has_many :projects - # accepts_nested_attributes_for :projects - # end - # # If you want to destroy any of the associated models through the # form, you have to enable it first using the :allow_destroy # option for +accepts_nested_attributes_for+: @@ -1425,14 +1417,6 @@ module ActionView # ... # <% end %> # - # When projects is already an association on Person you can use - # +accepts_nested_attributes_for+ to define the writer method for you: - # - # class Person < ActiveRecord::Base - # has_many :projects - # accepts_nested_attributes_for :projects - # end - # # If you want to destroy any of the associated models through the # form, you have to enable it first using the :allow_destroy # option for +accepts_nested_attributes_for+: From 18f9d46d4ff0c9be6f4561d06d66f4c55b81731c Mon Sep 17 00:00:00 2001 From: Carlos Puchol Date: Fri, 22 Mar 2013 00:56:39 -0700 Subject: [PATCH 39/64] 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(-) 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 ``` From 6645dc3571a23bc5a69622e4ab22af30df7cb2b5 Mon Sep 17 00:00:00 2001 From: Carson McDonald Date: Fri, 22 Mar 2013 08:41:38 -0400 Subject: [PATCH 40/64] Fix typo [ci skip] --- activerecord/lib/active_record/relation/query_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index b7960936cf..588e3f2ddd 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -614,7 +614,7 @@ module ActiveRecord # # The returned ActiveRecord::NullRelation inherits from Relation and implements the # Null Object pattern. It is an object with defined null behavior and always returns an empty - # array of records without quering the database. + # array of records without querying the database. # # Any subsequent condition chained to the returned relation will continue # generating an empty relation and will not fire any query to the database. From 5be6122c399ca15c8f1bf7051f12bfee2b85e1c1 Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Fri, 22 Mar 2013 10:27:41 -0300 Subject: [PATCH 41/64] Add minitest-spec-rails to guide's testing options --- guides/source/testing.md | 1 + 1 file changed, 1 insertion(+) 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 From 12cecdd345ae36816c2eb7f94e3855a7fcfed2f8 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sat, 23 Mar 2013 09:40:32 +0530 Subject: [PATCH 42/64] Fixed typo : contraints -> constraints --- activerecord/test/cases/adapter_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 0af7cbf74f..bd114995f7 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -114,7 +114,7 @@ module ActiveRecord end end - # test resetting sequences in odd tables in postgreSQL + # test resetting sequences in odd tables in PostgreSQL if ActiveRecord::Base.connection.respond_to?(:reset_pk_sequence!) require 'models/movie' require 'models/subscriber' @@ -167,7 +167,7 @@ module ActiveRecord else @connection.execute "INSERT INTO fk_test_has_fk (fk_id) VALUES (0)" end - # should deleted created record as otherwise disable_referential_integrity will try to enable contraints after executed block + # should deleted created record as otherwise disable_referential_integrity will try to enable constraints after executed block # and will fail (at least on Oracle) @connection.execute "DELETE FROM fk_test_has_fk" end From d45145acdc576e46a1f1719d69bec96b5bf07b0a Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 24 Mar 2013 00:34:06 +0530 Subject: [PATCH 43/64] Changed 'args' to 'arguments' when used in places other than code with fixing few more typos --- actionpack/test/abstract/callbacks_test.rb | 2 +- actionpack/test/abstract/collector_test.rb | 2 +- activemodel/CHANGELOG.md | 4 ++-- guides/source/active_support_instrumentation.md | 2 +- guides/source/command_line.md | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb index 1090af3060..8cba049485 100644 --- a/actionpack/test/abstract/callbacks_test.rb +++ b/actionpack/test/abstract/callbacks_test.rb @@ -259,7 +259,7 @@ module AbstractController end class TestCallbacksWithArgs < ActiveSupport::TestCase - test "callbacks still work when invoking process with multiple args" do + test "callbacks still work when invoking process with multiple arguments" do controller = CallbacksWithArgs.new controller.process(:index, " Howdy!") assert_equal "Hello world Howdy!", controller.response_body diff --git a/actionpack/test/abstract/collector_test.rb b/actionpack/test/abstract/collector_test.rb index c14d24905b..5709ad0378 100644 --- a/actionpack/test/abstract/collector_test.rb +++ b/actionpack/test/abstract/collector_test.rb @@ -42,7 +42,7 @@ module AbstractController end end - test "generated methods call custom with args received" do + test "generated methods call custom with arguments received" do collector = MyCollector.new collector.html collector.text(:foo) diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index c6d7b0b5d3..6539cc4442 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -70,7 +70,7 @@ *Yves Senn* -* Use BCrypt's `MIN_COST` in the test environment for speedier tests when using `has_secure_pasword`. +* Use BCrypt's `MIN_COST` in the test environment for speedier tests when using `has_secure_password`. *Brian Cardarella + Jeremy Kemper + Trevor Turk* @@ -111,7 +111,7 @@ * Changed `ActiveModel::Serializers::Xml::Serializer#add_associations` to by default propagate `:skip_types, :dasherize, :camelize` keys to included associations. - It can be overriden on each association by explicitly specifying the option on one + It can be overridden on each association by explicitly specifying the option on one or more associations *Anthony Alberto* 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` From 49760c1ef9afb6290af21357126a88c51c835fa5 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 24 Mar 2013 01:53:01 +0530 Subject: [PATCH 44/64] Reverted code change introduced in d45145acdc576e46a1f1719d69bec96b5bf07b0a --- actionpack/test/abstract/callbacks_test.rb | 2 +- actionpack/test/abstract/collector_test.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb index 8cba049485..1090af3060 100644 --- a/actionpack/test/abstract/callbacks_test.rb +++ b/actionpack/test/abstract/callbacks_test.rb @@ -259,7 +259,7 @@ module AbstractController end class TestCallbacksWithArgs < ActiveSupport::TestCase - test "callbacks still work when invoking process with multiple arguments" do + test "callbacks still work when invoking process with multiple args" do controller = CallbacksWithArgs.new controller.process(:index, " Howdy!") assert_equal "Hello world Howdy!", controller.response_body diff --git a/actionpack/test/abstract/collector_test.rb b/actionpack/test/abstract/collector_test.rb index 5709ad0378..c14d24905b 100644 --- a/actionpack/test/abstract/collector_test.rb +++ b/actionpack/test/abstract/collector_test.rb @@ -42,7 +42,7 @@ module AbstractController end end - test "generated methods call custom with arguments received" do + test "generated methods call custom with args received" do collector = MyCollector.new collector.html collector.text(:foo) From 33d1e374082a482237f52569b489403abdb2770a Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 24 Mar 2013 02:14:21 +0530 Subject: [PATCH 45/64] Reverted change in activemodel/CHANGELOG.md introduced by d45145acdc576e46a1f1719d69bec96b5bf07b0a --- activemodel/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index 6539cc4442..c6d7b0b5d3 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -70,7 +70,7 @@ *Yves Senn* -* Use BCrypt's `MIN_COST` in the test environment for speedier tests when using `has_secure_password`. +* Use BCrypt's `MIN_COST` in the test environment for speedier tests when using `has_secure_pasword`. *Brian Cardarella + Jeremy Kemper + Trevor Turk* @@ -111,7 +111,7 @@ * Changed `ActiveModel::Serializers::Xml::Serializer#add_associations` to by default propagate `:skip_types, :dasherize, :camelize` keys to included associations. - It can be overridden on each association by explicitly specifying the option on one + It can be overriden on each association by explicitly specifying the option on one or more associations *Anthony Alberto* From a2bb6720fd5091d95aa8539ddf63386dcfb8feee Mon Sep 17 00:00:00 2001 From: Chao Ren Date: Sat, 23 Mar 2013 20:57:14 -0700 Subject: [PATCH 46/64] Typo: Migration class name would use plural --- guides/source/association_basics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 9a5d4288c59686af4acc8b3de7cb3283c5f5974c Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 24 Mar 2013 15:59:33 +0900 Subject: [PATCH 47/64] s/app\/model\//app\/models\//g --- guides/source/command_line.md | 8 ++++---- guides/source/migrations.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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 From 64dc614ca58732409695032c1458e6a4283a4fbb Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Sun, 24 Mar 2013 13:26:02 +0530 Subject: [PATCH 48/64] view/views, asset/assets --- guides/source/action_view_overview.md | 2 +- guides/source/getting_started.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 From 11c58831c3f72be9350a11b44360f7f41c6e2b60 Mon Sep 17 00:00:00 2001 From: Deshi Xiao Date: Sun, 24 Mar 2013 17:16:06 +0800 Subject: [PATCH 49/64] correct test command's typo --- guides/source/testing.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 From 5d5ade2b4122a73abd3498c815fd587ca185b19f Mon Sep 17 00:00:00 2001 From: Deshi Xiao Date: Sun, 24 Mar 2013 17:19:10 +0800 Subject: [PATCH 50/64] correct some typo in earlier commit. --- guides/source/testing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 0db928a63aee9ab5d9c277d551f17e28d860c8ae Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Mon, 25 Mar 2013 00:20:25 +0530 Subject: [PATCH 51/64] fix some typos --- guides/source/configuring.md | 4 ++-- guides/source/contributing_to_ruby_on_rails.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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: From 0725007fa457bdbbf49c333f8333d5e540ee9a15 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 25 Mar 2013 20:54:34 +0900 Subject: [PATCH 52/64] s/Github/GitHub/ --- guides/source/contributing_to_ruby_on_rails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e21f6c1daccbb5838b1e03e6acdcbc86bbadd7f8 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 25 Mar 2013 21:01:40 +0900 Subject: [PATCH 53/64] s/Textmate/TextMate/ --- 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 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. From ea5daeb2e407d004cf134d47fe8ac28d24fb0a00 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 25 Mar 2013 22:43:26 +0900 Subject: [PATCH 54/64] Fix some typos --- activesupport/lib/active_support/notifications/instrumenter.rb | 2 +- guides/source/active_support_instrumentation.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index 1ee7ca06bb..4f1cb85cc2 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -2,7 +2,7 @@ require 'securerandom' module ActiveSupport module Notifications - # Instrumentors are stored in a thread local. + # Instrumenters are stored in a thread local. class Instrumenter attr_reader :id 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| From f09bf78218288333ed0bb8beff70da33e0366d27 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Mon, 25 Mar 2013 21:09:46 +0530 Subject: [PATCH 55/64] localised => localized --- guides/source/active_support_core_extensions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 | | ---------------------- | ----------------------------------- | From 1595ab6c892a3a32d78c2142aacf83960e956b33 Mon Sep 17 00:00:00 2001 From: Carson McDonald Date: Tue, 26 Mar 2013 10:42:45 -0400 Subject: [PATCH 56/64] Fix typo --- actionpack/lib/action_view/template/resolver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb index 47bd011d5e..6b9b0a826b 100644 --- a/actionpack/lib/action_view/template/resolver.rb +++ b/actionpack/lib/action_view/template/resolver.rb @@ -255,7 +255,7 @@ module ActionView # # FileSystemResolver.new("/path/to/views", ":prefix/:action{.:locale,}{.:formats,}{.:handlers,}") # - # This one allows you to keep files with different formats in seperated subdirectories, + # This one allows you to keep files with different formats in separate subdirectories, # eg. `users/new.html` will be loaded from `users/html/new.erb` or `users/new.html.erb`, # `users/new.js` from `users/js/new.erb` or `users/new.js.erb`, etc. # From 164af1f9676230a557beed2de7bf7c5d5d7a95aa Mon Sep 17 00:00:00 2001 From: sthollmann Date: Wed, 27 Mar 2013 10:46:19 +0100 Subject: [PATCH 57/64] 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(-) 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. From d083193c994b4cf3d52b45fd1c054368bf3a8211 Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Wed, 27 Mar 2013 23:28:36 -0300 Subject: [PATCH 58/64] Extraneous syntax on guides path. --- guides/source/ruby_on_rails_guides_guidelines.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 057ae0b7fc41e617520d665f2d524daff514cb2b Mon Sep 17 00:00:00 2001 From: Jonathan Roes Date: Wed, 27 Mar 2013 23:30:51 -0300 Subject: [PATCH 59/64] Remove unnecessary hyphen. --- guides/source/debugging_rails_applications.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 %>

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

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

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

From 9c6ccb3224b40cefa05f3d14a381150059a87a09 Mon Sep 17 00:00:00 2001
From: Vinicius Quaiato 
Date: Fri, 29 Mar 2013 03:04:50 -0300
Subject: [PATCH 61/64] 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(+)

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`.

From d4dad040c39495f30b097f7178d13c40c2e19847 Mon Sep 17 00:00:00 2001
From: Neeraj Singh 
Date: Fri, 29 Mar 2013 15:38:16 -0400
Subject: [PATCH 62/64] explain method invertible_for [ci skip]

---
 activerecord/lib/active_record/associations/association.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index 868095f068..a5c8d6cf77 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -217,7 +217,8 @@ module ActiveRecord
           reflection.inverse_of
         end
 
-        # Is this association invertible? Can be redefined by subclasses.
+        # Returns true if inverse association on the given record needs to be set.
+        # This method is redefined by subclasses.
         def invertible_for?(record)
           inverse_reflection_for(record)
         end

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

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

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
 

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

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

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: