From fc20d6b6815032935f02b53b4b928cd514ed66ac Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Sat, 26 Nov 2011 22:38:58 +0530 Subject: [PATCH 01/12] Let's say this 3.1.3 instead of 3.1.1 in docs --- railties/guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index ca6a404212..fe43c9db36 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -248,7 +248,7 @@ the following: $ rails --version -If it says something like "Rails 3.1.1" you are ready to continue. +If it says something like "Rails 3.1.3" you are ready to continue. h4. Creating the Blog Application From 448df2d100feccf1d5df9db2b02b732a775d8406 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Sun, 27 Nov 2011 10:23:40 +0400 Subject: [PATCH 02/12] Cosmetic fixes in AM validatations docs --- activemodel/lib/active_model/validations/presence.rb | 6 +++--- activemodel/lib/active_model/validations/with.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/activemodel/lib/active_model/validations/presence.rb b/activemodel/lib/active_model/validations/presence.rb index 35af7152db..9a643a6f5c 100644 --- a/activemodel/lib/active_model/validations/presence.rb +++ b/activemodel/lib/active_model/validations/presence.rb @@ -25,14 +25,14 @@ module ActiveModel # This is due to the way Object#blank? handles boolean values: false.blank? # => true. # # Configuration options: - # * message - A custom error message (default is: "can't be blank"). + # * :message - A custom error message (default is: "can't be blank"). # * :on - Specifies when this validation is active. Runs in all # validation contexts by default (+nil+), other options are :create # and :update. - # * if - Specifies a method, proc or string to call to determine if the validation should + # * :if - Specifies a method, proc or string to call to determine if the validation should # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). # The method, proc or string should return or evaluate to a true or false value. - # * unless - Specifies a method, proc or string to call to determine if the validation should + # * :unless - Specifies a method, proc or string to call to determine if the validation should # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). # The method, proc or string should return or evaluate to a true or false value. # * :strict - Specifies whether validation should be strict. diff --git a/activemodel/lib/active_model/validations/with.rb b/activemodel/lib/active_model/validations/with.rb index 93a340eb39..72b8562b93 100644 --- a/activemodel/lib/active_model/validations/with.rb +++ b/activemodel/lib/active_model/validations/with.rb @@ -56,7 +56,7 @@ module ActiveModel # if the validation should occur (e.g. :if => :allow_validation, # or :if => Proc.new { |user| user.signup_step > 2 }). # The method, proc or string should return or evaluate to a true or false value. - # * unless - Specifies a method, proc or string to call to + # * :unless - Specifies a method, proc or string to call to # determine if the validation should not occur # (e.g. :unless => :skip_validation, or # :unless => Proc.new { |user| user.signup_step <= 2 }). From 0ce64ba9aa93c01ee69c45493ad8090e76f95ff4 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Sun, 27 Nov 2011 12:34:14 +0530 Subject: [PATCH 03/12] Documentation about config.log_level config options --- railties/guides/source/configuring.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 809948b41e..beb623757b 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -88,6 +88,8 @@ NOTE. The +config.asset_path+ configuration is ignored if the asset pipeline is * +config.log_level+ defines the verbosity of the Rails logger. This option defaults to +:debug+ for all modes except production, where it defaults to +:info+. +* +config.log_tags+ accepts a list of methods that respond to +request+ object. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications. + * +config.logger+ accepts a logger conforming to the interface of Log4r or the default Ruby +Logger+ class. Defaults to an instance of +ActiveSupport::BufferedLogger+, with auto flushing off in production mode. * +config.middleware+ allows you to configure the application's middleware. This is covered in depth in the "Configuring Middleware":#configuring-middleware section below. From 28e3935360c9392685c4954791cc320ed02e15c0 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Sun, 27 Nov 2011 12:53:08 +0530 Subject: [PATCH 04/12] [Docs] Adding RequestId middleware in configuring middleware --- railties/guides/source/configuring.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index beb623757b..d91011c370 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -190,6 +190,7 @@ Every Rails application comes with a standard set of middleware which it uses in * +Rack::Runtime+ sets an +X-Runtime+ header, containing the time (in seconds) taken to execute the request. * +Rails::Rack::Logger+ notifies the logs that the request has began. After request is complete, flushes all the logs. * +ActionDispatch::ShowExceptions+ rescues any exception returned by the application and renders nice exception pages if the request is local or if +config.consider_all_requests_local+ is set to +true+. If +config.action_dispatch.show_exceptions+ is set to +false+, exceptions will be raised regardless. +* +ActionDispatch::RequestId+ makes a unique X-Request-Id header available to the response and enables the +ActionDispatch::Request#uuid+ method. * +ActionDispatch::RemoteIp+ checks for IP spoofing attacks. Configurable with the +config.action_dispatch.ip_spoofing_check+ and +config.action_dispatch.trusted_proxies+ settings. * +Rack::Sendfile+ intercepts responses whose body is being served from a file and replaces it with a server specific X-Sendfile header. Configurable with +config.action_dispatch.x_sendfile_header+. * +ActionDispatch::Callbacks+ runs the prepare callbacks before serving the request. From 9cf285599c1e99736f5dd9d01f986c19dcf3d4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tadas=20Tamo=C5=A1auskas?= Date: Sun, 27 Nov 2011 12:44:14 +0000 Subject: [PATCH 05/12] Update Object#in? description for https://github.com/rails/rails/pull/3767 --- railties/guides/source/active_support_core_extensions.textile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index d601e9ea29..c1046a3b63 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -440,14 +440,16 @@ NOTE: Defined in +active_support/core_ext/kernel/reporting.rb+. h4. +in?+ -The predicate +in?+ tests if an object is included in another object. An +ArgumentError+ exception will be raised if the argument passed does not respond to +include?+. +The predicate +in?+ tests if an object is included in another object or a list of objects. An +ArgumentError+ exception will be raised if a single argument is passed and it does not respond to +include?+. Examples of +in?+: +1.in?(1,2) # => true 1.in?([1,2]) # => true "lo".in?("hello") # => true 25.in?(30..50) # => false +1.in?(1) # => ArgumentError NOTE: Defined in +active_support/core_ext/object/inclusion.rb+. From 2f428a6245a18017c7942f8fef3da4a85bec8cc5 Mon Sep 17 00:00:00 2001 From: Tim Reischmann Date: Mon, 28 Nov 2011 09:27:42 +0100 Subject: [PATCH 06/12] fixed typo in getting started form_for for comments --- railties/guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index fe43c9db36..3ff6603a4c 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -1297,7 +1297,7 @@ So first, we'll wire up the Post show template

Add a comment:

-<%= form_for([@post, @post.comments.build]) do |f| %> +<%= form_for([@post, @post.comment.build]) do |f| %>
<%= f.label :commenter %>
<%= f.text_field :commenter %> From e7dff9c1f1e3e8a73c1b5bc5fd4263126813489c Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Mon, 28 Nov 2011 14:10:23 +0530 Subject: [PATCH 07/12] Revert "fixed typo in getting started form_for for comments" This reverts commit 2f428a6245a18017c7942f8fef3da4a85bec8cc5. See comments here 2f428a6245a18017c7942f8fef3da4a85bec8cc5 --- railties/guides/source/getting_started.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 3ff6603a4c..fe43c9db36 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -1297,7 +1297,7 @@ So first, we'll wire up the Post show template

Add a comment:

-<%= form_for([@post, @post.comment.build]) do |f| %> +<%= form_for([@post, @post.comments.build]) do |f| %>
<%= f.label :commenter %>
<%= f.text_field :commenter %> From 6d05c793cafe79860bcbb469d6c46c83c531ab34 Mon Sep 17 00:00:00 2001 From: Rodrigo Rosenfeld Rosas Date: Mon, 28 Nov 2011 13:15:07 -0200 Subject: [PATCH 08/12] Update information about foreign key plugins support in the guides There is not "a number" of up-to-date maintained plugins for dealing with foreign keys. The foreign_key_migrations does not have any update since 2009 and is also about to be removed: Extracted from http://www.harukizaemon.com/2009/09/plugins-grab-em-while-theyre-stale.html, referenced in the plugin reference of the old guide version: "And so it is that I will very shortly (within the next month) delete most of the plugins from my GitHub account (harukizaemon)" --- railties/guides/source/migrations.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/migrations.textile b/railties/guides/source/migrations.textile index 5b52a93853..c63f2aa119 100644 --- a/railties/guides/source/migrations.textile +++ b/railties/guides/source/migrations.textile @@ -670,4 +670,4 @@ The Active Record way claims that intelligence belongs in your models, not in th Validations such as +validates :foreign_key, :uniqueness => true+ are one way in which models can enforce data integrity. The +:dependent+ option on associations allows models to automatically destroy child objects when the parent is destroyed. Like anything which operates at the application level, these cannot guarantee referential integrity and so some people augment them with foreign key constraints. -Although Active Record does not provide any tools for working directly with such features, the +execute+ method can be used to execute arbitrary SQL. There are also a number of plugins such as "foreign_key_migrations":https://github.com/harukizaemon/redhillonrails/tree/master/foreign_key_migrations/ which add foreign key support to Active Record (including support for dumping foreign keys in +db/schema.rb+). +Although Active Record does not provide any tools for working directly with such features, the +execute+ method can be used to execute arbitrary SQL. You could also use some plugin like "foreigner":https://github.com/matthuhiggins/foreigner which add foreign key support to Active Record (including support for dumping foreign keys in +db/schema.rb+). From 493cf44682c19bd69eb2463d260c3bf29c7a23d7 Mon Sep 17 00:00:00 2001 From: Sergey Parizhskiy Date: Mon, 28 Nov 2011 17:33:01 +0200 Subject: [PATCH 09/12] completed documentation for the rails server command --- railties/guides/source/command_line.textile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index 3f8643eca3..a26a139baf 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -81,6 +81,8 @@ 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. Use +-h+ or +--help+ option to get a list of all possible options that can be passed to the +rails server+ command. + h4. +rails generate+ The +rails generate+ command uses templates to create a whole lot of things. Running +rails generate+ by itself gives a list of available generators: From afa31cf327893d79826e0a7d5a8667a44213c161 Mon Sep 17 00:00:00 2001 From: Sergey Parizhskiy Date: Mon, 28 Nov 2011 17:40:14 +0200 Subject: [PATCH 10/12] there is no need to repeat about possibility of using -h option to get full help --- railties/guides/source/command_line.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index a26a139baf..9284a542f3 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -81,7 +81,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. Use +-h+ or +--help+ option to get a list of all possible options that can be passed to the +rails server+ command. +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. h4. +rails generate+ From 237272e049e409c9f620dfadb7cf0688e8c91b0f Mon Sep 17 00:00:00 2001 From: Travis Pew Date: Mon, 28 Nov 2011 15:46:09 -0500 Subject: [PATCH 11/12] Fix ActionDispatch::Request method explanations The methods, "post?", "put?", "head?", etc. contain an incorrect explanation. They state that they are equivalent to request_method == :type, but this is not accurate because the methods convert the string to a symbol. They are actually equivalent to: request_method_symbol == :type --- actionpack/lib/action_dispatch/http/request.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 69ca050d0c..e86dfd64d2 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -94,31 +94,31 @@ module ActionDispatch end # Is this a GET (or HEAD) request? - # Equivalent to request.request_method == :get. + # Equivalent to request.request_method_symbol == :get. def get? HTTP_METHOD_LOOKUP[request_method] == :get end # Is this a POST request? - # Equivalent to request.request_method == :post. + # Equivalent to request.request_method_symbol == :post. def post? HTTP_METHOD_LOOKUP[request_method] == :post end # Is this a PUT request? - # Equivalent to request.request_method == :put. + # Equivalent to request.request_method_symbol == :put. def put? HTTP_METHOD_LOOKUP[request_method] == :put end # Is this a DELETE request? - # Equivalent to request.request_method == :delete. + # Equivalent to request.request_method_symbol == :delete. def delete? HTTP_METHOD_LOOKUP[request_method] == :delete end # Is this a HEAD request? - # Equivalent to request.method == :head. + # Equivalent to request.method_symbol == :head. def head? HTTP_METHOD_LOOKUP[method] == :head end From e3bc1385f1e8d2816deb215880d99aca136c0cc3 Mon Sep 17 00:00:00 2001 From: Aviv Ben-Yosef Date: Wed, 30 Nov 2011 06:55:34 +0200 Subject: [PATCH 12/12] Fixing incorrect documentation `path_names` can only be used for affecting `new` and `edit` --- actionpack/lib/action_dispatch/routing/mapper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 7947e9d393..88e422c05d 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1046,8 +1046,8 @@ module ActionDispatch # Takes same options as Base#match as well as: # # [:path_names] - # Allows you to change the paths of the seven default actions. - # Paths not specified are not changed. + # Allows you to change the segment component of the +edit+ and +new+ actions. + # Actions not specified are not changed. # # resources :posts, :path_names => { :new => "brand_new" } #