From 3b18e900e8fc3c333dc52e71c7cb8413250ac192 Mon Sep 17 00:00:00 2001 From: John Paul Ashenfelter Date: Thu, 19 May 2011 01:20:26 -0400 Subject: [PATCH 01/47] Closes GH #1032 Fixed what looks like minor cut/paste error in documentation for ActiveRecord::Locking:Pessimistic --- activerecord/lib/active_record/locking/pessimistic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activerecord/lib/active_record/locking/pessimistic.rb b/activerecord/lib/active_record/locking/pessimistic.rb index 4c4c1bf5a1..66994e4797 100644 --- a/activerecord/lib/active_record/locking/pessimistic.rb +++ b/activerecord/lib/active_record/locking/pessimistic.rb @@ -14,7 +14,7 @@ module ActiveRecord # Account.transaction do # # select * from accounts where name = 'shugo' limit 1 for update # shugo = Account.where("name = 'shugo'").lock(true).first - # yuko = Account.where("name = 'shugo'").lock(true).first + # yuko = Account.where("name = 'yuko'").lock(true).first # shugo.balance -= 100 # shugo.save! # yuko.balance += 100 From 223f3117f164692595e7c66feaa4df0469ca0f80 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Thu, 19 May 2011 20:46:43 -0300 Subject: [PATCH 02/47] Remove extra white-spaces. --- .../lib/active_record/associations.rb | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 9bc44e5163..3e8255d759 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -468,9 +468,9 @@ module ActiveRecord # === Association Join Models # # Has Many associations can be configured with the :through option to use an - # explicit join model to retrieve the data. This operates similarly to a - # +has_and_belongs_to_many+ association. The advantage is that you're able to add validations, - # callbacks, and extra attributes on the join model. Consider the following schema: + # explicit join model to retrieve the data. This operates similarly to a + # +has_and_belongs_to_many+ association. The advantage is that you're able to add validations, + # callbacks, and extra attributes on the join model. Consider the following schema: # # class Author < ActiveRecord::Base # has_many :authorships @@ -527,7 +527,7 @@ module ActiveRecord # @group.avatars # selects all avatars by going through the User join model. # # An important caveat with going through +has_one+ or +has_many+ associations on the - # join model is that these associations are *read-only*. For example, the following + # join model is that these associations are *read-only*. For example, the following # would not work following the previous example: # # @group.avatars << Avatar.new # this would work if User belonged_to Avatar rather than the other way around @@ -595,7 +595,7 @@ module ActiveRecord # === Polymorphic Associations # # Polymorphic associations on models are not restricted on what types of models they - # can be associated with. Rather, they specify an interface that a +has_many+ association + # can be associated with. Rather, they specify an interface that a +has_many+ association # must adhere to. # # class Asset < ActiveRecord::Base @@ -609,7 +609,7 @@ module ActiveRecord # @asset.attachable = @post # # This works by using a type column in addition to a foreign key to specify the associated - # record. In the Asset example, you'd need an +attachable_id+ integer column and an + # record. In the Asset example, you'd need an +attachable_id+ integer column and an # +attachable_type+ string column. # # Using polymorphic associations in combination with single table inheritance (STI) is @@ -740,7 +740,7 @@ module ActiveRecord # Picture.find(:first, :include => :most_recent_comments).most_recent_comments # => returns all associated comments. # # When eager loaded, conditions are interpolated in the context of the model class, not - # the model instance. Conditions are lazily interpolated before the actual model exists. + # the model instance. Conditions are lazily interpolated before the actual model exists. # # Eager loading is supported with polymorphic associations. # @@ -764,7 +764,7 @@ module ActiveRecord # == Table Aliasing # # Active Record uses table aliasing in the case that a table is referenced multiple times - # in a join. If a table is referenced only once, the standard table name is used. The + # in a join. If a table is referenced only once, the standard table name is used. The # second time, the table is aliased as #{reflection_name}_#{parent_table_name}. # Indexes are appended for any more successive uses of the table name. # @@ -846,7 +846,7 @@ module ActiveRecord # == Bi-directional associations # # When you specify an association there is usually an association on the associated model - # that specifies the same relationship in reverse. For example, with the following models: + # that specifies the same relationship in reverse. For example, with the following models: # # class Dungeon < ActiveRecord::Base # has_many :traps @@ -863,9 +863,9 @@ module ActiveRecord # # The +traps+ association on +Dungeon+ and the +dungeon+ association on +Trap+ are # the inverse of each other and the inverse of the +dungeon+ association on +EvilWizard+ - # is the +evil_wizard+ association on +Dungeon+ (and vice-versa). By default, + # is the +evil_wizard+ association on +Dungeon+ (and vice-versa). By default, # Active Record doesn't know anything about these inverse relationships and so no object - # loading optimisation is possible. For example: + # loading optimisation is possible. For example: # # d = Dungeon.first # t = d.traps.first @@ -875,8 +875,8 @@ module ActiveRecord # # The +Dungeon+ instances +d+ and t.dungeon in the above example refer to # the same object data from the database, but are actually different in-memory copies - # of that data. Specifying the :inverse_of option on associations lets you tell - # Active Record about inverse relationships and it will optimise object loading. For + # of that data. Specifying the :inverse_of option on associations lets you tell + # Active Record about inverse relationships and it will optimise object loading. For # example, if we changed our model definitions to: # # class Dungeon < ActiveRecord::Base @@ -1059,7 +1059,7 @@ module ActiveRecord # specify it with this option. # [:conditions] # Specify the conditions that the associated objects must meet in order to be included as a +WHERE+ - # SQL fragment, such as price > 5 AND name LIKE 'B%'. Record creations from + # SQL fragment, such as price > 5 AND name LIKE 'B%'. Record creations from # the association are scoped if a hash is used. # has_many :posts, :conditions => {:published => true} will create published # posts with @blog.posts.create or @blog.posts.build. @@ -1074,8 +1074,8 @@ module ActiveRecord # Specify the method that returns the primary key used for the association. By default this is +id+. # [:dependent] # If set to :destroy all the associated objects are destroyed - # alongside this object by calling their +destroy+ method. If set to :delete_all all associated - # objects are deleted *without* calling their +destroy+ method. If set to :nullify all associated + # alongside this object by calling their +destroy+ method. If set to :delete_all all associated + # objects are deleted *without* calling their +destroy+ method. If set to :nullify all associated # objects' foreign keys are set to +NULL+ *without* calling their +save+ callbacks. If set to # :restrict this object cannot be deleted if it has any associated object. # @@ -1242,7 +1242,7 @@ module ActiveRecord # you want to do a join but not include the joined columns. Do not forget to include the # primary and foreign keys, otherwise it will raise an error. # [:through] - # Specifies a Join Model through which to perform the query. Options for :class_name, + # Specifies a Join Model through which to perform the query. Options for :class_name, # :primary_key, and :foreign_key are ignored, as the association uses the # source reflection. You can only use a :through query through a has_one # or belongs_to association on the join model. @@ -1264,7 +1264,7 @@ module ActiveRecord # By default, only save the associated object if it's a new record. # [:inverse_of] # Specifies the name of the belongs_to association on the associated object - # that is the inverse of this has_one association. Does not work in combination + # that is the inverse of this has_one association. Does not work in combination # with :through or :as options. # See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail. # @@ -1382,7 +1382,7 @@ module ActiveRecord # will be updated with the current time in addition to the updated_at/on attribute. # [:inverse_of] # Specifies the name of the has_one or has_many association on the associated - # object that is the inverse of this belongs_to association. Does not work in + # object that is the inverse of this belongs_to association. Does not work in # combination with the :polymorphic options. # See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail. # @@ -1402,15 +1402,15 @@ module ActiveRecord end # Specifies a many-to-many relationship with another class. This associates two classes via an - # intermediate join table. Unless the join table is explicitly specified as an option, it is + # intermediate join table. Unless the join table is explicitly specified as an option, it is # guessed using the lexical order of the class names. So a join between Developer and Project # will give the default join table name of "developers_projects" because "D" outranks "P". - # Note that this precedence is calculated using the < operator for String. This + # Note that this precedence is calculated using the < operator for String. This # means that if the strings are of different lengths, and the strings are equal when compared # up to the shortest length, then the longer string is considered of higher - # lexical precedence than the shorter one. For example, one would expect the tables "paper_boxes" and "papers" + # lexical precedence than the shorter one. For example, one would expect the tables "paper_boxes" and "papers" # to generate a join table name of "papers_paper_boxes" because of the length of the name "paper_boxes", - # but it in fact generates a join table name of "paper_boxes_papers". Be aware of this caveat, and use the + # but it in fact generates a join table name of "paper_boxes_papers". Be aware of this caveat, and use the # custom :join_table option if you need to. # # The join table should not have a primary key or a model associated with it. You must manually generate the @@ -1512,7 +1512,7 @@ module ActiveRecord # the association will use "project_id" as the default :association_foreign_key. # [:conditions] # Specify the conditions that the associated object must meet in order to be included as a +WHERE+ - # SQL fragment, such as authorized = 1. Record creations from the association are + # SQL fragment, such as authorized = 1. Record creations from the association are # scoped if a hash is used. # has_many :posts, :conditions => {:published => true} will create published posts with @blog.posts.create # or @blog.posts.build. From 0d310d590c310ed6551fb38164379a2465caaa89 Mon Sep 17 00:00:00 2001 From: Diego Plentz Date: Thu, 19 May 2011 17:38:15 -0700 Subject: [PATCH 03/47] fixes code highlight in shallow_path example --- actionpack/lib/action_dispatch/routing/mapper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 3ba6094fbb..8af4971e69 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -1090,11 +1090,11 @@ module ActionDispatch # [:shallow_path] # Prefixes nested shallow routes with the specified path. # - # scope :shallow_path => "sekret" do - # resources :posts do - # resources :comments, :shallow => true + # scope :shallow_path => "sekret" do + # resources :posts do + # resources :comments, :shallow => true + # end # end - # end # # The +comments+ resource here will have the following routes generated for it: # From 0cb812a50ebf5eaf0653efca721704dbb60ffc7d Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Thu, 19 May 2011 21:12:11 -0700 Subject: [PATCH 04/47] Changing examples: use 'each' instead of 'for in' --- 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 3e8255d759..d1752a25ff 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -665,7 +665,7 @@ module ActiveRecord # # Consider the following loop using the class above: # - # for post in Post.all + # Post.all.each do |post| # puts "Post: " + post.title # puts "Written by: " + post.author.name # puts "Last comment on: " + post.comments.first.created_on @@ -674,7 +674,7 @@ module ActiveRecord # To iterate over these one hundred posts, we'll generate 201 database queries. Let's # first just optimize it for retrieving the author: # - # for post in Post.find(:all, :include => :author) + # Post.find(:all, :include => :author).each do |post| # # This references the name of the +belongs_to+ association that also used the :author # symbol. After loading the posts, find will collect the +author_id+ from each one and load @@ -683,7 +683,7 @@ module ActiveRecord # # We can improve upon the situation further by referencing both associations in the finder with: # - # for post in Post.find(:all, :include => [ :author, :comments ]) + # Post.find(:all, :include => [ :author, :comments ]).each do |post| # # This will load all comments with a single query. This reduces the total number of queries # to 3. More generally the number of queries will be 1 plus the number of associations @@ -691,7 +691,7 @@ module ActiveRecord # # To include a deep hierarchy of associations, use a hash: # - # for post in Post.find(:all, :include => [ :author, { :comments => { :author => :gravatar } } ]) + # Post.find(:all, :include => [ :author, { :comments => { :author => :gravatar } } ]).each do |post| # # That'll grab not only all the comments but all their authors and gravatar pictures. # You can mix and match symbols, arrays and hashes in any combination to describe the From 22abbb862a49d685a9e6767c994b20ba051c2fea Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Thu, 19 May 2011 22:26:34 -0700 Subject: [PATCH 05/47] Replacing 'for' with 'each' in actionmailer guide --- railties/guides/source/action_mailer_basics.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/action_mailer_basics.textile b/railties/guides/source/action_mailer_basics.textile index a6ff8f877d..4c5d792f85 100644 --- a/railties/guides/source/action_mailer_basics.textile +++ b/railties/guides/source/action_mailer_basics.textile @@ -419,7 +419,7 @@ class UserMailer < ActionMailer::Base ) if email.has_attachments? - for attachment in email.attachments + email.attachments.each do |attachment| page.attachments.create({ :file => attachment, :description => email.subject From d0373507e79952c902f82500742910d769d70d09 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Thu, 19 May 2011 22:30:51 -0700 Subject: [PATCH 06/47] Using each instead of for in actionview guide --- railties/guides/source/action_view_overview.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index 2b2c197f46..b064851312 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -615,7 +615,7 @@ atom_feed do |feed| feed.title("Posts Index") feed.updated((@posts.first.created_at)) - for post in @posts + @posts.each do |post| feed.entry(post) do |entry| entry.title(post.title) entry.content(post.body, :type => 'html') From 93570bb321ca886d36c79c680e17ed577ea06768 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Thu, 19 May 2011 22:33:43 -0700 Subject: [PATCH 07/47] Changin 'for' with 'each' on FormHelpers guide --- railties/guides/source/form_helpers.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/form_helpers.textile b/railties/guides/source/form_helpers.textile index a63245acec..4134c9f8ed 100644 --- a/railties/guides/source/form_helpers.textile +++ b/railties/guides/source/form_helpers.textile @@ -712,7 +712,7 @@ You might want to render a form with a set of edit fields for each of a person's <%= form_for @person do |person_form| %> <%= person_form.text_field :name %> - <% for address in @person.addresses %> + <% @person.addresses.each do |address| %> <%= person_form.fields_for address, :index => address do |address_form|%> <%= address_form.text_field :city %> <% end %> From ad3e057e4878a3abc7c30210cbf15680b359a2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?U=C4=A3is=20Ozols?= Date: Fri, 20 May 2011 20:26:20 +0300 Subject: [PATCH 08/47] Remove duplicate words. --- 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 e26f73ed8d..6dcc99e4e8 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -180,7 +180,7 @@ module Rails # my_engine:install:assets # # Engine name is set by default based on class name. For MyEngine::Engine it will be - # my_engine_engine. You can change it manually it manually using the engine_name method: + # my_engine_engine. You can change it manually using the engine_name method: # # module MyEngine # class Engine < Rails::Engine From bf50935a5dc1e41d4134ae975cc01886b722c13d Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Fri, 20 May 2011 21:56:08 -0300 Subject: [PATCH 09/47] Add more doc to #update_column. --- activerecord/lib/active_record/persistence.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index b9041f44d8..221823364c 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -133,6 +133,8 @@ module ActiveRecord # * Callbacks are skipped. # * updated_at/updated_on column is not updated if that column is available. # + # Raises an +ActiveRecordError+ when called on new objects, or when the +name+ + # attribute is marked as readonly. def update_column(name, value) name = name.to_s raise ActiveRecordError, "#{name} is marked as readonly" if self.class.readonly_attributes.include?(name) From 0087ef9665e82eec357331ebce759fb1298286a7 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sat, 21 May 2011 16:51:05 -0300 Subject: [PATCH 10/47] Remove extra white spaces. --- railties/guides/source/security.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/security.textile b/railties/guides/source/security.textile index e0ccc7a6e6..1a1339137c 100644 --- a/railties/guides/source/security.textile +++ b/railties/guides/source/security.textile @@ -386,7 +386,7 @@ params[:user] # => {:name => “ow3ned”, :admin => true} So if you create a new user using mass-assignment, it may be too easy to become an administrator. -Note that this vulnerability is not restricted to database columns. Any setter method, unless explicitly protected, is accessible via the attributes= method. In fact, this vulnerability is extended even further with the introduction of nested mass assignment (and nested object forms) in Rails 2.3+. The +accepts_nested_attributes_for+ declaration provides us the ability to extend mass assignment to model associations (+has_many+, +has_one+, +has_and_belongs_to_many+). For example: +Note that this vulnerability is not restricted to database columns. Any setter method, unless explicitly protected, is accessible via the attributes= method. In fact, this vulnerability is extended even further with the introduction of nested mass assignment (and nested object forms) in Rails 2.3+. The +accepts_nested_attributes_for+ declaration provides us the ability to extend mass assignment to model associations (+has_many+, +has_one+, +has_and_belongs_to_many+). For example: class Person < ActiveRecord::Base @@ -469,7 +469,7 @@ A more paranoid technique to protect your whole project would be to enforce that config.active_record.whitelist_attributes = true -This will create an empty whitelist of attributes available for mass-assignment for all models in your app. As such, your models will need to explicitly whitelist or blacklist accessible parameters by using an +attr_accessible+ or +attr_protected+ declaration. This technique is best applied at the start of a new project. However, for an existing project with a thorough set of functional tests, it should be straightforward and relatively quick to use this application config option; run your tests, and expose each attribute (via +attr_accessible+ or +attr_protected+) as dictated by your failing tests. +This will create an empty whitelist of attributes available for mass-assignment for all models in your app. As such, your models will need to explicitly whitelist or blacklist accessible parameters by using an +attr_accessible+ or +attr_protected+ declaration. This technique is best applied at the start of a new project. However, for an existing project with a thorough set of functional tests, it should be straightforward and relatively quick to use this application config option; run your tests, and expose each attribute (via +attr_accessible+ or +attr_protected+) as dictated by your failing tests. h3. User Management From 31f09a2b1821886164ffb629085d0f5b75bd0a40 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sat, 21 May 2011 17:10:59 -0300 Subject: [PATCH 11/47] Remove extra white spaces on guides. --- .../guides/source/3_0_release_notes.textile | 42 +++++++++---------- .../source/action_mailer_basics.textile | 6 +-- .../guides/source/getting_started.textile | 2 +- railties/guides/source/plugins.textile | 2 +- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/railties/guides/source/3_0_release_notes.textile b/railties/guides/source/3_0_release_notes.textile index f75b245ed8..fbb684978a 100644 --- a/railties/guides/source/3_0_release_notes.textile +++ b/railties/guides/source/3_0_release_notes.textile @@ -61,7 +61,7 @@ h4. Upgrade Process To help with the upgrade process, a plugin named "Rails Upgrade":http://github.com/jm/rails_upgrade has been created to automate part of it. -Simply install the plugin, then run +rake rails:upgrade:check+ to check your app for pieces that need to be updated (with links to information on how to update them). It also offers a task to generate a +Gemfile+ based on your current +config.gem+ calls and a task to generate a new routes file from your current one. To get the plugin, simply run the following: +Simply install the plugin, then run +rake rails:upgrade:check+ to check your app for pieces that need to be updated (with links to information on how to update them). It also offers a task to generate a +Gemfile+ based on your current +config.gem+ calls and a task to generate a new routes file from your current one. To get the plugin, simply run the following: $ ruby script/plugin install git://github.com/jm/rails_upgrade.git @@ -69,7 +69,7 @@ $ ruby script/plugin install git://github.com/jm/rails_upgrade.git You can see an example of how that works at "Rails Upgrade is now an Official Plugin":http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin -Aside from Rails Upgrade tool, if you need more help, there are people on IRC and "rubyonrails-talk":http://groups.google.com/group/rubyonrails-talk that are probably doing the same thing, possibly hitting the same issues. Be sure to blog your own experiences when upgrading so others can benefit from your knowledge! +Aside from Rails Upgrade tool, if you need more help, there are people on IRC and "rubyonrails-talk":http://groups.google.com/group/rubyonrails-talk that are probably doing the same thing, possibly hitting the same issues. Be sure to blog your own experiences when upgrading so others can benefit from your knowledge! More information - "The Path to Rails 3: Approaching the upgrade":http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade @@ -113,42 +113,42 @@ Railties was updated to provide a consistent plugin API for the entire Rails fra h4. All Rails core components are decoupled -With the merge of Merb and Rails, one of the big jobs was to remove the tight coupling between Rails core components. This has now been achieved, and all Rails core components are now using the same API that you can use for developing plugins. This means any plugin you make, or any core component replacement (like DataMapper or Sequel) can access all the functionality that the Rails core components have access to and extend and enhance at will. +With the merge of Merb and Rails, one of the big jobs was to remove the tight coupling between Rails core components. This has now been achieved, and all Rails core components are now using the same API that you can use for developing plugins. This means any plugin you make, or any core component replacement (like DataMapper or Sequel) can access all the functionality that the Rails core components have access to and extend and enhance at will. More information: - "The Great Decoupling":http://yehudakatz.com/2009/07/19/rails-3-the-great-decoupling/ h4. Active Model Abstraction -Part of decoupling the core components was extracting all ties to Active Record from Action Pack. This has now been completed. All new ORM plugins now just need to implement Active Model interfaces to work seamlessly with Action Pack. +Part of decoupling the core components was extracting all ties to Active Record from Action Pack. This has now been completed. All new ORM plugins now just need to implement Active Model interfaces to work seamlessly with Action Pack. More information: - "Make Any Ruby Object Feel Like ActiveRecord":http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/ h4. Controller Abstraction -Another big part of decoupling the core components was creating a base superclass that is separated from the notions of HTTP in order to handle rendering of views etc. This creation of +AbstractController+ allowed +ActionController+ and +ActionMailer+ to be greatly simplified with common code removed from all these libraries and put into Abstract Controller. +Another big part of decoupling the core components was creating a base superclass that is separated from the notions of HTTP in order to handle rendering of views etc. This creation of +AbstractController+ allowed +ActionController+ and +ActionMailer+ to be greatly simplified with common code removed from all these libraries and put into Abstract Controller. More Information: - "Rails Edge Architecture":http://yehudakatz.com/2009/06/11/rails-edge-architecture/ h4. Arel Integration -"Arel":http://github.com/brynary/arel (or Active Relation) has been taken on as the underpinnings of Active Record and is now required for Rails. Arel provides an SQL abstraction that simplifies out Active Record and provides the underpinnings for the relation functionality in Active Record. +"Arel":http://github.com/brynary/arel (or Active Relation) has been taken on as the underpinnings of Active Record and is now required for Rails. Arel provides an SQL abstraction that simplifies out Active Record and provides the underpinnings for the relation functionality in Active Record. More information: - "Why I wrote Arel":http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/. h4. Mail Extraction -Action Mailer ever since its beginnings has had monkey patches, pre parsers and even delivery and receiver agents, all in addition to having TMail vendored in the source tree. Version 3 changes that with all email message related functionality abstracted out to the "Mail":http://github.com/mikel/mail gem. This again reduces code duplication and helps create definable boundaries between Action Mailer and the email parser. +Action Mailer ever since its beginnings has had monkey patches, pre parsers and even delivery and receiver agents, all in addition to having TMail vendored in the source tree. Version 3 changes that with all email message related functionality abstracted out to the "Mail":http://github.com/mikel/mail gem. This again reduces code duplication and helps create definable boundaries between Action Mailer and the email parser. More information: - "New Action Mailer API in Rails 3":http://lindsaar.net/2010/1/26/new-actionmailer-api-in-rails-3 h3. Documentation -The documentation in the Rails tree is being updated with all the API changes, additionally, the "Rails Edge Guides":http://edgeguides.rubyonrails.org/ are being updated one by one to reflect the changes in Rails 3.0. The guides at "guides.rubyonrails.org":http://guides.rubyonrails.org/ however will continue to contain only the stable version of Rails (at this point, version 2.3.5, until 3.0 is released). +The documentation in the Rails tree is being updated with all the API changes, additionally, the "Rails Edge Guides":http://edgeguides.rubyonrails.org/ are being updated one by one to reflect the changes in Rails 3.0. The guides at "guides.rubyonrails.org":http://guides.rubyonrails.org/ however will continue to contain only the stable version of Rails (at this point, version 2.3.5, until 3.0 is released). More Information: - "Rails Documentation Projects":http://weblog.rubyonrails.org/2009/1/15/rails-documentation-projects. @@ -157,7 +157,7 @@ h3. Internationalization A large amount of work has been done with I18n support in Rails 3, including the latest "I18n":http://github.com/svenfuchs/i18n gem supplying many speed improvements. -* I18n for any object - I18n behavior can be added to any object by including ActiveModel::Translation and ActiveModel::Validations. There is also an errors.messages fallback for translations. +* I18n for any object - I18n behavior can be added to any object by including ActiveModel::Translation and ActiveModel::Validations. There is also an errors.messages fallback for translations. * Attributes can have default translations. * Form Submit Tags automatically pull the correct status (Create or Update) depending on the object status, and so pull the correct translation. * Labels with I18n also now work by just passing the attribute name. @@ -173,7 +173,7 @@ With the decoupling of the main Rails frameworks, Railties got a huge overhaul s * Anything under Rails.root/app is now added to the load path, so you can make app/observers/user_observer.rb and Rails will load it without any modifications. * Rails 3.0 now provides a Rails.config object, which provides a central repository of all sorts of Rails wide configuration options. -Application generation has received extra flags allowing you to skip the installation of test-unit, Active Record, Prototype and Git. Also a new --dev flag has been added which sets the application up with the +Gemfile+ pointing to your Rails checkout (which is determined by the path to the +rails+ binary). See rails --help for more info. +Application generation has received extra flags allowing you to skip the installation of test-unit, Active Record, Prototype and Git. Also a new --dev flag has been added which sets the application up with the +Gemfile+ pointing to your Rails checkout (which is determined by the path to the +rails+ binary). See rails --help for more info. Railties generators got a huge amount of attention in Rails 3.0, basically: @@ -215,7 +215,7 @@ There have been significant internal and external changes in Action Pack. h4. Abstract Controller -Abstract Controller pulls out the generic parts of Action Controller into a reusable module that any library can use to render templates, render partials, helpers, translations, logging, any part of the request response cycle. This abstraction allowed ActionMailer::Base to now just inherit from +AbstractController+ and just wrap the Rails DSL onto the Mail gem. +Abstract Controller pulls out the generic parts of Action Controller into a reusable module that any library can use to render templates, render partials, helpers, translations, logging, any part of the request response cycle. This abstraction allowed ActionMailer::Base to now just inherit from +AbstractController+ and just wrap the Rails DSL onto the Mail gem. It also provided an opportunity to clean up Action Controller, abstracting out what could to simplify the code. @@ -231,7 +231,7 @@ h4. Action Controller * The session_store was configured in ActionController::Base.session, and that is now moved to Rails.application.config.session_store. Defaults are set up in config/initializers/session_store.rb. * cookies.secure allowing you to set encrypted values in cookies with cookie.secure[:key] => value. * cookies.permanent allowing you to set permanent values in the cookie hash cookie.permanent[:key] => value that raise exceptions on signed values if verification failures. -* You can now pass :notice => 'This is a flash message' or :alert => 'Something went wrong' to the format call inside a +respond_to+ block. The flash[] hash still works as previously. +* You can now pass :notice => 'This is a flash message' or :alert => 'Something went wrong' to the format call inside a +respond_to+ block. The flash[] hash still works as previously. * respond_with method has now been added to your controllers simplifying the venerable +format+ blocks. * ActionController::Responder added allowing you flexibility in how your responses get generated. @@ -298,9 +298,9 @@ h4. Action View h5. Unobtrusive JavaScript -Major re-write was done in the Action View helpers, implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands. This enables Rails to use any compliant UJS driver to implement the UJS hooks in the helpers. +Major re-write was done in the Action View helpers, implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands. This enables Rails to use any compliant UJS driver to implement the UJS hooks in the helpers. -What this means is that all previous remote_<method> helpers have been removed from Rails core and put into the "Prototype Legacy Helper":http://github.com/rails/prototype_legacy_helper. To get UJS hooks into your HTML, you now pass :remote => true instead. For example: +What this means is that all previous remote_<method> helpers have been removed from Rails core and put into the "Prototype Legacy Helper":http://github.com/rails/prototype_legacy_helper. To get UJS hooks into your HTML, you now pass :remote => true instead. For example: form_for @post, :remote => true @@ -341,12 +341,12 @@ h5. Other Changes h3. Active Model -Active Model is new in Rails 3.0. It provides an abstraction layer for any ORM libraries to use to interact with Rails by implementing an Active Model interface. +Active Model is new in Rails 3.0. It provides an abstraction layer for any ORM libraries to use to interact with Rails by implementing an Active Model interface. h4. ORM Abstraction and Action Pack Interface -Part of decoupling the core components was extracting all ties to Active Record from Action Pack. This has now been completed. All new ORM plugins now just need to implement Active Model interfaces to work seamlessly with Action Pack. +Part of decoupling the core components was extracting all ties to Active Record from Action Pack. This has now been completed. All new ORM plugins now just need to implement Active Model interfaces to work seamlessly with Action Pack. More Information: - "Make Any Ruby Object Feel Like ActiveRecord":http://yehudakatz.com/2010/01/10/activemodel-make-any-ruby-object-feel-like-activerecord/ @@ -410,12 +410,12 @@ More Information: h3. Active Record -Active Record received a lot of attention in Rails 3.0, including abstraction into Active Model, a full update to the Query interface using Arel, validation updates and many enhancements and fixes. All of the Rails 2.x API will be usable through a compatibility layer that will be supported until version 3.1. +Active Record received a lot of attention in Rails 3.0, including abstraction into Active Model, a full update to the Query interface using Arel, validation updates and many enhancements and fixes. All of the Rails 2.x API will be usable through a compatibility layer that will be supported until version 3.1. h4. Query Interface -Active Record, through the use of Arel, now returns relations on its core methods. The existing API in Rails 2.3.x is still supported and will not be deprecated until Rails 3.1 and not removed until Rails 3.2, however, the new API provides the following new methods that all return relations allowing them to be chained together: +Active Record, through the use of Arel, now returns relations on its core methods. The existing API in Rails 2.3.x is still supported and will not be deprecated until Rails 3.1 and not removed until Rails 3.2, however, the new API provides the following new methods that all return relations allowing them to be chained together: * where - provides conditions on the relation, what gets returned. * select - choose what attributes of the models you wish to have returned from the database. @@ -502,7 +502,7 @@ Deprecations: h3. Active Support -A large effort was made in Active Support to make it cherry pickable, that is, you no longer have to require the entire Active Support library to get pieces of it. This allows the various core components of Rails to run slimmer. +A large effort was made in Active Support to make it cherry pickable, that is, you no longer have to require the entire Active Support library to get pieces of it. This allows the various core components of Rails to run slimmer. These are the main changes in Active Support: @@ -559,7 +559,7 @@ The following methods have been removed because they are no longer used in the f h3. Action Mailer -Action Mailer has been given a new API with TMail being replaced out with the new "Mail":http://github.com/mikel/mail as the Email library. Action Mailer itself has been given an almost complete re-write with pretty much every line of code touched. The result is that Action Mailer now simply inherits from Abstract Controller and wraps the Mail gem in a Rails DSL. This reduces the amount of code and duplication of other libraries in Action Mailer considerably. +Action Mailer has been given a new API with TMail being replaced out with the new "Mail":http://github.com/mikel/mail as the Email library. Action Mailer itself has been given an almost complete re-write with pretty much every line of code touched. The result is that Action Mailer now simply inherits from Abstract Controller and wraps the Mail gem in a Rails DSL. This reduces the amount of code and duplication of other libraries in Action Mailer considerably. * All mailers are now in app/mailers by default. * Can now send email using new API with three methods: +attachments+, +headers+ and +mail+. @@ -589,7 +589,7 @@ More Information: h3. Credits -See the "full list of contributors to Rails":http://contributors.rubyonrails.org/ for the many people who spent many hours making Rails 3. Kudos to all of them. +See the "full list of contributors to Rails":http://contributors.rubyonrails.org/ for the many people who spent many hours making Rails 3. Kudos to all of them. Rails 3.0 Release Notes were compiled by "Mikel Lindsaar":http://lindsaar.net. diff --git a/railties/guides/source/action_mailer_basics.textile b/railties/guides/source/action_mailer_basics.textile index 4c5d792f85..e1ff49cd60 100644 --- a/railties/guides/source/action_mailer_basics.textile +++ b/railties/guides/source/action_mailer_basics.textile @@ -104,7 +104,7 @@ When you call the +mail+ method now, Action Mailer will detect the two templates h5. Wire It Up So That the System Sends the Email When a User Signs Up -There are several ways to do this, some people create Rails Observers to fire off emails, others do it inside of the User Model. However, in Rails 3, mailers are really just another way to render a view. Instead of rendering a view and sending out the HTTP protocol, they are just sending it out through the Email protocols instead. Due to this, it makes sense to just have your controller tell the mailer to send an email when a user is successfully created. +There are several ways to do this, some people create Rails Observers to fire off emails, others do it inside of the User Model. However, in Rails 3, mailers are really just another way to render a view. Instead of rendering a view and sending out the HTTP protocol, they are just sending it out through the Email protocols instead. Due to this, it makes sense to just have your controller tell the mailer to send an email when a user is successfully created. Setting this up is painfully simple. @@ -293,7 +293,7 @@ class UserMailer < ActionMailer::Base end -Will render 'another_template.text.erb' and 'another_template.html.erb'. The render command is the same one used inside of Action Controller, so you can use all the same options, such as :text etc. +Will render 'another_template.text.erb' and 'another_template.html.erb'. The render command is the same one used inside of Action Controller, so you can use all the same options, such as :text etc. h4. Action Mailer Layouts @@ -363,7 +363,7 @@ h4. Sending Multipart Emails Action Mailer will automatically send multipart emails if you have different templates for the same action. So, for our UserMailer example, if you have +welcome_email.text.erb+ and +welcome_email.html.erb+ in +app/views/user_mailer+, Action Mailer will automatically send a multipart email with the HTML and text versions setup as different parts. -The order of the parts getting inserted is determined by the :parts_order inside of the ActionMailer::Base.default method. If you want to explicitly alter the order, you can either change the :parts_order or explicitly render the parts in a different order: +The order of the parts getting inserted is determined by the :parts_order inside of the ActionMailer::Base.default method. If you want to explicitly alter the order, you can either change the :parts_order or explicitly render the parts in a different order: class UserMailer < ActionMailer::Base diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 1c66115d44..8a9086f416 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -544,7 +544,7 @@ This view iterates over the contents of the +@posts+ array to display content an * +link_to+ builds a hyperlink to a particular destination * +edit_post_path+ and +new_post_path+ are helpers that Rails provides as part of RESTful routing. You'll see a variety of these helpers for the different actions that the controller includes. -NOTE. In previous versions of Rails, you had to use +<%=h post.name %>+ so that any HTML would be escaped before being inserted into the page. In Rails 3.0, this is now the default. To get unescaped HTML, you now use +<%= raw post.name %>+. +NOTE. In previous versions of Rails, you had to use +<%=h post.name %>+ so that any HTML would be escaped before being inserted into the page. In Rails 3.0, this is now the default. To get unescaped HTML, you now use +<%= raw post.name %>+. TIP: For more details on the rendering process, see "Layouts and Rendering in Rails":layouts_and_rendering.html. diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index d486e8ade3..b12aa78947 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -319,7 +319,7 @@ When you run +rake+ you should see the tests all pass: h4. Add an Instance Method -This plugin will add a method named 'squawk' to any Active Record objects that call 'acts_as_yaffle'. The 'squawk' +This plugin will add a method named 'squawk' to any Active Record objects that call 'acts_as_yaffle'. The 'squawk' method will simply set the value of one of the fields in the database. To start out, write a failing test that shows the behavior you'd like: From e368a3468ff209825a74075afcd4045f85963b66 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Sat, 21 May 2011 17:33:28 -0700 Subject: [PATCH 12/47] Removed the `enginex` plugin reference which is broken -- rails 3.1.0.beta1 has that functionality now. --- railties/guides/source/plugins.textile | 35 ++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index b12aa78947..842b538bc8 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -25,33 +25,36 @@ endprologue. h3. Setup -h4. Generating the Plugin Skeleton +Before you continue, take a moment to decide if your new plugin will be potentially shared across different rails applications. -Rails currently ships with a generator to generate a plugin within a Rails application. Help text is available that will explain -how this generator works. +* If your plugin is specific to your application, your new plugin will be a _vendored plugin_. +* If you think your plugin may be used across applications, build it as a _gemified plugin_. + +h4. Either generate a vendored plugin... + +Use the +rails generate plugin+ command in your rails root directory + to create a new plugin that will live in the +vendor/plugins+ + directory. See usage and options by asking for help: -$ rails generate plugin --help +$ rails generate plugin new --help -This generator places the plugin into the vendor/plugins directory. +h4. Or generate a gemified plugin. -Vendored plugins are useful for quickly prototyping your plugin but current thinking in the Rails community is shifting towards -packaging plugins as gems, especially with the inclusion of Bundler as the Rails dependency manager. -Packaging a plugin as a gem may be overkill for any plugins that will not be shared across projects but doing so from the start makes it easier to share the plugin going forward without adding too much additional overhead during development. +Writing your rails plugin as a gem, rather than as a vendored plugin, + lets you share your plugin across different rails applications using + rubygems and bundler. -Rails 3.1 will ship with a plugin generator that will default to setting up a plugin -as a gem. This tutorial will begin to bridge that gap by demonstrating how to create a gem based plugin using the -"Enginex gem":http://www.github.com/josevalim/enginex. +Rails 3.1 ships with a +rails plugin new+ command which creates a + skeleton for developing any kind of Rails extension with the ability + to run integration tests using a dummy Rails application. See usage + and options by asking for help: -$ gem install enginex -$ enginex --help -$ enginex yaffle +$ rails plugin --help -This command will create a new directory named "yaffle" within the current directory. - h3. Testing your newly generated plugin You can navigate to the directory that contains the plugin, run the +bundle install+ command From 023ca4fd4879f62107bcfb633d51eb57e3b6cfd7 Mon Sep 17 00:00:00 2001 From: Anuj Dutta Date: Sun, 22 May 2011 11:27:02 +0100 Subject: [PATCH 13/47] Fixed documentation for scope with path. --- 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 8af4971e69..860f7eced2 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -578,8 +578,8 @@ module ActionDispatch # end # # This generates helpers such as +account_projects_path+, just like +resources+ does. - # The difference here being that the routes generated are like /rails/projects/2, - # rather than /accounts/rails/projects/2. + # The difference here being that the routes generated are like /:account_id/projects, + # rather than /accounts/:account_id/projects. # # === Options # From e4f6e6ad2d00cf2a205a405c18b4c7f284d153fd Mon Sep 17 00:00:00 2001 From: Aditya Sanghi Date: Sun, 22 May 2011 04:47:04 -0700 Subject: [PATCH 14/47] has_many :dependent => :restrict raises an exception but is not documented appropriately. has_one also has :dependent => :restrict but is not documented at all. --- activerecord/lib/active_record/associations.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index d1752a25ff..2116a94980 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -1077,7 +1077,8 @@ module ActiveRecord # alongside this object by calling their +destroy+ method. If set to :delete_all all associated # objects are deleted *without* calling their +destroy+ method. If set to :nullify all associated # objects' foreign keys are set to +NULL+ *without* calling their +save+ callbacks. If set to - # :restrict this object cannot be deleted if it has any associated object. + # :restrict this object raises an ActiveRecord::DeleteRestrictionError exception and + # cannot be deleted if it has 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 @@ -1226,7 +1227,8 @@ module ActiveRecord # If set to :destroy, the associated object is destroyed when this object is. If set to # :delete, the associated object is deleted *without* calling its destroy method. # If set to :nullify, the associated object's foreign key is set to +NULL+. - # Also, association is assigned. + # Also, association is assigned. If set to :restrict this object raises an + # ActiveRecord::DeleteRestrictionError exception and cannot be deleted if it has any associated object. # [:foreign_key] # Specify the foreign key used for the association. By default this is guessed to be the name # of this class in lower-case and "_id" suffixed. So a Person class that makes a +has_one+ association From 330fc8c48d91b8909985fd82d7fc3761b1242526 Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Sun, 22 May 2011 16:07:47 -0700 Subject: [PATCH 15/47] Following proper naming conventions while referring to Rails, Bundler --- railties/guides/source/plugins.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index 842b538bc8..b71cd0c89d 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -25,14 +25,14 @@ endprologue. h3. Setup -Before you continue, take a moment to decide if your new plugin will be potentially shared across different rails applications. +Before you continue, take a moment to decide if your new plugin will be potentially shared across different Rails applications. * If your plugin is specific to your application, your new plugin will be a _vendored plugin_. * If you think your plugin may be used across applications, build it as a _gemified plugin_. h4. Either generate a vendored plugin... -Use the +rails generate plugin+ command in your rails root directory +Use the +rails generate plugin+ command in your Rails root directory to create a new plugin that will live in the +vendor/plugins+ directory. See usage and options by asking for help: @@ -42,9 +42,9 @@ $ rails generate plugin new --help h4. Or generate a gemified plugin. -Writing your rails plugin as a gem, rather than as a vendored plugin, +Writing your Rails plugin as a gem, rather than as a vendored plugin, lets you share your plugin across different rails applications using - rubygems and bundler. + RubyGems and Bundler. Rails 3.1 ships with a +rails plugin new+ command which creates a skeleton for developing any kind of Rails extension with the ability From cb7677180ba4b04d96bd6907305c04049950b1c7 Mon Sep 17 00:00:00 2001 From: Matthew Daubert Date: Sun, 22 May 2011 21:17:38 -0400 Subject: [PATCH 16/47] Minor typo describing engine helpers --- railties/lib/rails/engine.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 6dcc99e4e8..de004700ab 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -296,7 +296,7 @@ module Rails # helper MyEngine::SharedEngineHelper # end # - # If you want to include all of the engine's helpers, you can use #helpers method on egine's + # If you want to include all of the engine's helpers, you can use #helpers method on an engine's # instance: # # class ApplicationController < ActionController::Base @@ -305,7 +305,7 @@ module Rails # # It will include all of the helpers from engine's directory. Take into account that this does # not include helpers defined in controllers with helper_method or other similar solutions, - # only helpers defined in helpers directory will be included. + # only helpers defined in the helpers directory will be included. # # == Migrations & seed data # From 09314f21c5ad9125aaaa3d7a3b1ddee417fb5a03 Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Mon, 23 May 2011 16:38:51 +0200 Subject: [PATCH 17/47] removed require_library_or_gem from the AS core extensions guide --- .../source/active_support_core_extensions.textile | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 66869b4eeb..43aa6dfbbb 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -436,20 +436,6 @@ end NOTE: Defined in +active_support/core_ext/kernel/reporting.rb+. -h4. +require_library_or_gem+ - -The convenience method +require_library_or_gem+ tries to load its argument with a regular +require+ first. If it fails loads +rubygems+ and tries again. - -If the first attempt is a failure and +rubygems+ can't be loaded the method raises +LoadError+. A +LoadError+ is also raised if +rubygems+ is available but the argument is not loadable as a gem. - -For example, that's the way the MySQL adapter loads the MySQL library: - - -require_library_or_gem('mysql') - - -NOTE: Defined in +active_support/core_ext/kernel/requires.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?+. From c76c4f6f67e65f9cecd242414689b0b6746bf834 Mon Sep 17 00:00:00 2001 From: JudeArasu Date: Mon, 23 May 2011 22:43:22 +0530 Subject: [PATCH 18/47] rails request has been moved from Lighthouse to Github, contribution link has been changed --- README.rdoc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index 143fdfeb75..c5499ae8ef 100644 --- a/README.rdoc +++ b/README.rdoc @@ -60,9 +60,10 @@ Rails. You can read more about Action Pack in its == Contributing We encourage you to contribute to Ruby on Rails! Please check out the {Contributing to Rails -guide}[http://edgeguides.rubyonrails.org/contributing_to_rails.html] for guidelines about how +guide}[http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how to proceed. {Join us}[http://contributors.rubyonrails.org]! == License Ruby on Rails is released under the MIT license. + From 424eff52090bf8b1901ea8a698933a1ff89db995 Mon Sep 17 00:00:00 2001 From: "Karunakar (Ruby)" Date: Tue, 24 May 2011 00:11:29 +0530 Subject: [PATCH 19/47] active resource instalation instructions and Licence --- activeresource/README.rdoc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/activeresource/README.rdoc b/activeresource/README.rdoc index afa25e1676..4fa11adec5 100644 --- a/activeresource/README.rdoc +++ b/activeresource/README.rdoc @@ -20,6 +20,16 @@ Model classes are mapped to remote REST resources by Active Resource much the sa tables. When a request is made to a remote resource, a REST XML request is generated, transmitted, and the result received and serialized into a usable Ruby object. +== Download and installation + +The latest version of Active Support can be installed with Rubygems: + + % [sudo] gem install activeresource + +Source code can be downloaded as part of the Rails project on GitHub + +* https://github.com/rails/rails/tree/master/activeresource/ + === Configuration and Usage Putting Active Resource to use is very similar to Active Record. It's as simple as creating a model class @@ -160,6 +170,18 @@ Destruction of a resource can be invoked as a class and instance method of the r Person.delete(2) # => true Person.exists?(2) # => false +== License + +Active Support is released under the MIT license. + +== Support + +API documentation is at + +* http://api.rubyonrails.com + +Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here: + +* https://github.com/rails/rails/issues You can find more usage information in the ActiveResource::Base documentation. - From 12ab1653dc9263d35f0633ff1a0c83f97c96f4bf Mon Sep 17 00:00:00 2001 From: Matthew McEachen Date: Mon, 23 May 2011 14:13:57 -0700 Subject: [PATCH 20/47] NOTE: doesn't handle newlines. --- railties/guides/source/plugins.textile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index b71cd0c89d..53d2381db4 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -390,9 +390,7 @@ Run +rake+ one final time and you should see: 7 tests, 7 assertions, 0 failures, 0 errors, 0 skips -NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can -interact with the model, and will not always be the right method to use. For example, you could also -use +send("#{self.class.yaffle_text_field}=", string.to_squawk)+. +NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use +send("#{self.class.yaffle_text_field}=", string.to_squawk)+. h3. Generators From c6ec7e825e37a894d47386e9d6ca3021de1eb056 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 20:09:58 -0300 Subject: [PATCH 21/47] Fix styling error on plugins guide. --- railties/guides/source/plugins.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index 53d2381db4..2eb71e49c4 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -390,7 +390,7 @@ Run +rake+ one final time and you should see: 7 tests, 7 assertions, 0 failures, 0 errors, 0 skips -NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use +send("#{self.class.yaffle_text_field}=", string.to_squawk)+. +NOTE: The use of +write_attribute+ to write to the field in model is just one example of how a plugin can interact with the model, and will not always be the right method to use. For example, you could also use send("#{self.class.yaffle_text_field}=", string.to_squawk). h3. Generators From fcdb5dc55729f4939e9a5064dfee8eef2dec4316 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 20:22:33 -0300 Subject: [PATCH 22/47] Remove extra white spaces on ActionPack docs. --- actionpack/lib/abstract_controller/base.rb | 2 +- actionpack/lib/abstract_controller/helpers.rb | 2 +- .../lib/action_controller/caching/actions.rb | 4 ++-- .../action_controller/metal/data_streaming.rb | 6 +++--- .../metal/http_authentication.rb | 4 ++-- .../metal/request_forgery_protection.rb | 6 +++--- .../vendor/html-scanner/html/sanitizer.rb | 2 +- .../lib/action_dispatch/http/mime_type.rb | 4 ++-- actionpack/lib/action_dispatch/http/request.rb | 6 +++--- .../lib/action_dispatch/middleware/cookies.rb | 2 +- .../lib/action_dispatch/routing/mapper.rb | 2 +- .../lib/action_dispatch/routing/url_for.rb | 2 +- .../testing/assertions/routing.rb | 18 +++++++++--------- .../lib/action_dispatch/testing/integration.rb | 2 +- .../lib/action_view/helpers/capture_helper.rb | 4 ++-- .../lib/action_view/helpers/date_helper.rb | 2 +- .../action_view/helpers/form_options_helper.rb | 8 ++++---- .../lib/action_view/helpers/form_tag_helper.rb | 2 +- .../lib/action_view/helpers/sanitize_helper.rb | 10 +++++----- .../lib/action_view/helpers/tag_helper.rb | 2 +- .../lib/action_view/helpers/text_helper.rb | 4 ++-- .../lib/action_view/helpers/url_helper.rb | 12 ++++++------ 22 files changed, 53 insertions(+), 53 deletions(-) diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index f67d0e558e..fd6a46fbec 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -10,7 +10,7 @@ module AbstractController # AbstractController::Base is a low-level API. Nobody should be # using it directly, and subclasses (like ActionController::Base) are # expected to provide their own +render+ method, since rendering means - # different things depending on the context. + # different things depending on the context. class Base attr_internal :response_body attr_internal :action_name diff --git a/actionpack/lib/abstract_controller/helpers.rb b/actionpack/lib/abstract_controller/helpers.rb index dc9778a416..77cc4c07d9 100644 --- a/actionpack/lib/abstract_controller/helpers.rb +++ b/actionpack/lib/abstract_controller/helpers.rb @@ -67,7 +67,7 @@ module AbstractController # helper FooHelper # => includes FooHelper # # When the argument is a string or symbol, the method will provide the "_helper" suffix, require the file - # and include the module in the template class. The second form illustrates how to include custom helpers + # and include the module in the template class. The second form illustrates how to include custom helpers # when working with namespaced controllers, or other cases where the file containing the helper definition is not # in one of Rails' standard load paths: # helper :foo # => requires 'foo_helper' and includes FooHelper diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index 5fc6956266..667ba15cc9 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -39,8 +39,8 @@ module ActionController #:nodoc: # :action => 'list', :format => :xml. # # You can set modify the default action cache path by passing a - # :cache_path option. This will be passed directly to - # ActionCachePath.path_for. This is handy for actions with + # :cache_path option. This will be passed directly to + # ActionCachePath.path_for. This is handy for actions with # multiple possible routes that should be cached differently. If a # block is given, it is called with the current controller instance. # diff --git a/actionpack/lib/action_controller/metal/data_streaming.rb b/actionpack/lib/action_controller/metal/data_streaming.rb index 997bc6e958..623a9873fc 100644 --- a/actionpack/lib/action_controller/metal/data_streaming.rb +++ b/actionpack/lib/action_controller/metal/data_streaming.rb @@ -37,7 +37,7 @@ module ActionController #:nodoc: # # The default Content-Type and Content-Disposition headers are # set to download arbitrary binary files in as many browsers as - # possible. IE versions 4, 5, 5.5, and 6 are all known to have + # possible. IE versions 4, 5, 5.5, and 6 are all known to have # a variety of quirks (especially when downloading over SSL). # # Simple download: @@ -58,8 +58,8 @@ module ActionController #:nodoc: # # Also be aware that the document may be cached by proxies and browsers. # The Pragma and Cache-Control headers declare how the file may be cached - # by intermediaries. They default to require clients to validate with - # the server before releasing cached responses. See + # by intermediaries. They default to require clients to validate with + # the server before releasing cached responses. See # http://www.mnot.net/cache_docs/ for an overview of web caching and # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 # for the Cache-Control header spec. diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb index 1d6df89007..2ad571b2b5 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -400,7 +400,7 @@ module ActionController # the present token and options. # # controller - ActionController::Base instance for the current request. - # login_procedure - Proc to call if a token is present. The Proc should + # login_procedure - Proc to call if a token is present. The Proc should # take 2 arguments: # authenticate(controller) { |token, options| ... } # @@ -413,7 +413,7 @@ module ActionController end end - # Parses the token and options out of the token authorization header. If + # Parses the token and options out of the token authorization header. If # the header looks like this: # Authorization: Token token="abc", nonce="def" # Then the returned token is "abc", and the options is {:nonce => "def"} diff --git a/actionpack/lib/action_controller/metal/request_forgery_protection.rb b/actionpack/lib/action_controller/metal/request_forgery_protection.rb index 13044a7450..b1d1b5cca6 100644 --- a/actionpack/lib/action_controller/metal/request_forgery_protection.rb +++ b/actionpack/lib/action_controller/metal/request_forgery_protection.rb @@ -63,7 +63,7 @@ module ActionController #:nodoc: # # Valid Options: # - # * :only/:except - Passed to the before_filter call. Set which actions are verified. + # * :only/:except - Passed to the before_filter call. Set which actions are verified. def protect_from_forgery(options = {}) self.request_forgery_protection_token ||= :authenticity_token prepend_before_filter :verify_authenticity_token, options @@ -71,7 +71,7 @@ module ActionController #:nodoc: end protected - # The actual before_filter that is used. Modify this to change how you handle unverified requests. + # The actual before_filter that is used. Modify this to change how you handle unverified requests. def verify_authenticity_token unless verified_request? logger.debug "WARNING: Can't verify CSRF token authenticity" if logger @@ -83,7 +83,7 @@ module ActionController #:nodoc: reset_session end - # Returns true or false if a request is verified. Checks: + # Returns true or false if a request is verified. Checks: # # * is it a GET request? Gets should be safe and idempotent # * Does the form_authenticity_token match the given token value from the params? diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb index 91a97c02ff..eaefdc0f15 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb @@ -103,7 +103,7 @@ module HTML # Specifies the default Set of allowed shorthand css properties for the #sanitize and #sanitize_css helpers. self.shorthand_css_properties = Set.new(%w(background border margin padding)) - # Sanitizes a block of css code. Used by #sanitize when it comes across a style attribute + # Sanitizes a block of css code. Used by #sanitize when it comes across a style attribute def sanitize_css(style) # disallow urls style = style.to_s.gsub(/url\s*\(\s*[^\s)]+?\s*\)\s*/, ' ') diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb index 7c9ebe7c7b..fa2948c8db 100644 --- a/actionpack/lib/action_dispatch/http/mime_type.rb +++ b/actionpack/lib/action_dispatch/http/mime_type.rb @@ -47,7 +47,7 @@ module Mime cattr_reader :html_types # These are the content types which browsers can generate without using ajax, flash, etc - # i.e. following a link, getting an image or posting a form. CSRF protection + # i.e. following a link, getting an image or posting a form. CSRF protection # only needs to protect against these types. @@browser_generated_types = Set.new [:html, :url_encoded_form, :multipart_form, :text] cattr_reader :browser_generated_types @@ -246,7 +246,7 @@ module Mime end end - # Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See + # Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See # ActionController::RequestForgeryProtection. def verify_request? @@browser_generated_types.include?(to_sym) diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index ccb866f4f7..499a272f6e 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -172,10 +172,10 @@ module ActionDispatch )\. }x - # Determines originating IP address. REMOTE_ADDR is the standard - # but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or + # Determines originating IP address. REMOTE_ADDR is the standard + # but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or # HTTP_X_FORWARDED_FOR are set by proxies so check for these if - # REMOTE_ADDR is a proxy. HTTP_X_FORWARDED_FOR may be a comma- + # REMOTE_ADDR is a proxy. HTTP_X_FORWARDED_FOR may be a comma- # delimited list in the case of multiple chained proxies; the last # address which is not trusted is the originating IP. def remote_ip diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 24ebb8fed7..d04780a230 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -59,7 +59,7 @@ module ActionDispatch # The option symbols for setting cookies are: # # * :value - The cookie's value or list of values (as an array). - # * :path - The path for which this cookie applies. Defaults to the root + # * :path - The path for which this cookie applies. Defaults to the root # of the application. # * :domain - The domain for which this cookie applies so you can # restrict to the domain level. If you use a schema like www.example.com diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 860f7eced2..3fac9a0d0e 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -335,7 +335,7 @@ module ActionDispatch # # [:on] # Shorthand for wrapping routes in a specific RESTful context. Valid - # values are +:member+, +:collection+, and +:new+. Only use within + # values are +:member+, +:collection+, and +:new+. Only use within # resource(s) block. For example: # # resource :bar do diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index 5893f86798..480144fe9d 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -108,7 +108,7 @@ module ActionDispatch end # Generate a url based on the options provided, default_url_options and the - # routes defined in routes.rb. The following options are supported: + # routes defined in routes.rb. The following options are supported: # # * :only_path - If true, the relative url is returned. Defaults to +false+. # * :protocol - The protocol to connect to. Defaults to 'http'. diff --git a/actionpack/lib/action_dispatch/testing/assertions/routing.rb b/actionpack/lib/action_dispatch/testing/assertions/routing.rb index b760db42e2..57a24a1bd9 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/routing.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/routing.rb @@ -7,18 +7,18 @@ module ActionDispatch # Suite of assertions to test routes generated by \Rails and the handling of requests made to them. module RoutingAssertions # Asserts that the routing of the given +path+ was handled correctly and that the parsed options (given in the +expected_options+ hash) - # match +path+. Basically, it asserts that \Rails recognizes the route given by +expected_options+. + # match +path+. Basically, it asserts that \Rails recognizes the route given by +expected_options+. # - # Pass a hash in the second argument (+path+) to specify the request method. This is useful for routes - # requiring a specific HTTP method. The hash should contain a :path with the incoming request path + # Pass a hash in the second argument (+path+) to specify the request method. This is useful for routes + # requiring a specific HTTP method. The hash should contain a :path with the incoming request path # and a :method containing the required HTTP verb. # # # assert that POSTing to /items will call the create action on ItemsController # assert_recognizes({:controller => 'items', :action => 'create'}, {:path => 'items', :method => :post}) # - # You can also pass in +extras+ with a hash containing URL parameters that would normally be in the query string. This can be used - # to assert that values in the query string string will end up in the params hash correctly. To test query strings you must use the - # extras argument, appending the query string on the path directly will not work. For example: + # You can also pass in +extras+ with a hash containing URL parameters that would normally be in the query string. This can be used + # to assert that values in the query string string will end up in the params hash correctly. To test query strings you must use the + # extras argument, appending the query string on the path directly will not work. For example: # # # assert that a path of '/items/list/1?view=print' returns the correct options # assert_recognizes({:controller => 'items', :action => 'list', :id => '1', :view => 'print'}, 'items/list/1', { :view => "print" }) @@ -49,7 +49,7 @@ module ActionDispatch assert_equal(expected_options, request.path_parameters, msg) end - # Asserts that the provided options can be used to generate the provided path. This is the inverse of +assert_recognizes+. + # Asserts that the provided options can be used to generate the provided path. This is the inverse of +assert_recognizes+. # The +extras+ parameter is used to tell the request the names and values of additional request parameters that would be in # a query string. The +message+ parameter allows you to specify a custom error message for assertion failures. # @@ -92,10 +92,10 @@ module ActionDispatch end # Asserts that path and options match both ways; in other words, it verifies that path generates - # options and then that options generates path. This essentially combines +assert_recognizes+ + # options and then that options generates path. This essentially combines +assert_recognizes+ # and +assert_generates+ into one step. # - # The +extras+ hash allows you to specify options that would normally be provided as a query string to the action. The + # The +extras+ hash allows you to specify options that would normally be provided as a query string to the action. The # +message+ parameter allows you to specify a custom error message to display upon failure. # # ==== Examples diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb index 7d707d03a9..9791ba58e2 100644 --- a/actionpack/lib/action_dispatch/testing/integration.rb +++ b/actionpack/lib/action_dispatch/testing/integration.rb @@ -62,7 +62,7 @@ module ActionDispatch # # The request_method is +:get+, +:post+, +:put+, +:delete+ or +:head+; the # parameters are +nil+, a hash, or a url-encoded or multipart string; - # the headers are a hash. Keys are automatically upcased and prefixed + # the headers are a hash. Keys are automatically upcased and prefixed # with 'HTTP_' if not already. def xml_http_request(request_method, path, parameters = nil, headers = nil) headers ||= {} diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index 3b5f4e694f..62f95379cd 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -27,7 +27,7 @@ module ActionView # "The current timestamp is #{Time.now}." # end # - # You can then use that variable anywhere else. For example: + # You can then use that variable anywhere else. For example: # # # <%= @greeting %> @@ -76,7 +76,7 @@ module ActionView # # <%= stored_content %> # - # You can use the yield syntax alongside an existing call to yield in a layout. For example: + # You can use the yield syntax alongside an existing call to yield in a layout. For example: # # <%# This is the layout %> # diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index c78c03a5eb..56e3af683b 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -517,7 +517,7 @@ module ActionView # # that is named 'due' rather than 'day'. # select_day(my_time, :field_name => 'due') # - # # Generates a select field for days with a custom prompt. Use :prompt => true for a + # # Generates a select field for days with a custom prompt. Use :prompt => true for a # # generic prompt. # select_day(5, :prompt => 'Choose day') # diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 0aaa690129..794132637c 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -125,7 +125,7 @@ module ActionView # This allows the user to submit a form page more than once with the expected results of creating multiple records. # In addition, this allows a single partial to be used to generate form inputs for both edit and create forms. # - # By default, post.person_id is the selected option. Specify :selected => value to use a different selection + # By default, post.person_id is the selected option. Specify :selected => value to use a different selection # or :selected => nil to leave all options unselected. Similarly, you can specify values to be disabled in the option # tags by specifying the :disabled option. This can either be a single value or an array of values to be disabled. def select(object, method, choices, options = {}, html_options = {}) @@ -255,7 +255,7 @@ module ActionView # Accepts a container (hash, array, enumerable, your type) and returns a string of option tags. Given a container # where the elements respond to first and last (such as a two-element array), the "lasts" serve as option values and # the "firsts" as option text. Hashes are turned into this form automatically, so the keys become "firsts" and values - # become lasts. If +selected+ is specified, the matching "last" or element will get the selected option-tag. +selected+ + # become lasts. If +selected+ is specified, the matching "last" or element will get the selected option-tag. +selected+ # may also be an array of values to be selected when using a multiple select. # # Examples (call, result): @@ -406,13 +406,13 @@ module ActionView # wraps them with tags. # # Parameters: - # * +grouped_options+ - Accepts a nested array or hash of strings. The first value serves as the + # * +grouped_options+ - Accepts a nested array or hash of strings. The first value serves as the # label while the second value must be an array of options. The second value can be a # nested array of text-value pairs. See options_for_select for more info. # Ex. ["North America",[["United States","US"],["Canada","CA"]]] # * +selected_key+ - A value equal to the +value+ attribute for one of the tags, # which will have the +selected+ attribute set. Note: It is possible for this value to match multiple options - # as you might have the same option in multiple groups. Each will then get selected="selected". + # as you might have the same option in multiple groups. Each will then get selected="selected". # * +prompt+ - set to true or a prompt string. When the select element doesn't have a value yet, this # prepends an option with a generic prompt - "Please select" - or the given prompt string. # diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 65a98fb27a..a91e86f4db 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -204,7 +204,7 @@ module ActionView text_field_tag(name, value, options.stringify_keys.update("type" => "hidden")) end - # Creates a file upload field. If you are using file uploads then you will also need + # Creates a file upload field. If you are using file uploads then you will also need # to set the multipart option for the form tag: # # <%= form_tag '/upload', :multipart => true do %> diff --git a/actionpack/lib/action_view/helpers/sanitize_helper.rb b/actionpack/lib/action_view/helpers/sanitize_helper.rb index 841be0a567..bcc8f6fbcb 100644 --- a/actionpack/lib/action_view/helpers/sanitize_helper.rb +++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb @@ -14,13 +14,13 @@ module ActionView # # It also strips href/src tags with invalid protocols, like javascript: especially. # It does its best to counter any tricks that hackers may use, like throwing in - # unicode/ascii/hex values to get past the javascript: filters. Check out + # unicode/ascii/hex values to get past the javascript: filters. Check out # the extensive test suite. # # <%= sanitize @article.body %> # # You can add or remove tags/attributes if you want to customize it a bit. - # See ActionView::Base for full docs on the available options. You can add + # See ActionView::Base for full docs on the available options. You can add # tags/attributes for single uses of +sanitize+ by passing either the # :attributes or :tags options: # @@ -66,7 +66,7 @@ module ActionView self.class.white_list_sanitizer.sanitize_css(style) end - # Strips all HTML tags from the +html+, including comments. This uses the + # Strips all HTML tags from the +html+, including comments. This uses the # html-scanner tokenizer and so its HTML parsing ability is limited by # that of html-scanner. # @@ -142,7 +142,7 @@ module ActionView white_list_sanitizer.protocol_separator = value end - # Gets the HTML::FullSanitizer instance used by +strip_tags+. Replace with + # Gets the HTML::FullSanitizer instance used by +strip_tags+. Replace with # any object that responds to +sanitize+. # # class Application < Rails::Application @@ -153,7 +153,7 @@ module ActionView @full_sanitizer ||= HTML::FullSanitizer.new end - # Gets the HTML::LinkSanitizer instance used by +strip_links+. Replace with + # Gets the HTML::LinkSanitizer instance used by +strip_links+. Replace with # any object that responds to +sanitize+. # # class Application < Rails::Application diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 786af5ca58..8c33ef09fa 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -94,7 +94,7 @@ module ActionView end end - # Returns a CDATA section with the given +content+. CDATA sections + # Returns a CDATA section with the given +content+. CDATA sections # are used to escape blocks of text containing characters which would # otherwise be recognized as markup. CDATA sections begin with the string # and end with (and may not contain) the string ]]>. diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index ca09c77b5c..75422a343d 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -232,7 +232,7 @@ module ActionView # considered as a linebreak and a
tag is appended. This # method does not remove the newlines from the +text+. # - # You can pass any HTML attributes into html_options. These + # You can pass any HTML attributes into html_options. These # will be added to all created paragraphs. # # ==== Options @@ -267,7 +267,7 @@ module ActionView # Creates a Cycle object whose _to_s_ method cycles through elements of an # array every time it is called. This can be used for example, to alternate - # classes for table rows. You can use named cycles to allow nesting in loops. + # classes for table rows. You can use named cycles to allow nesting in loops. # Passing a Hash as the last parameter with a :name key will create a # named cycle. The default name for a cycle without a +:name+ key is # "default". You can manually reset a cycle by calling reset_cycle diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 5488c752cc..25411856cb 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -160,7 +160,7 @@ module ActionView # # ==== Examples # Because it relies on +url_for+, +link_to+ supports both older-style controller/action/id arguments - # and newer RESTful routes. Current Rails style favors RESTful routes whenever possible, so base + # and newer RESTful routes. Current Rails style favors RESTful routes whenever possible, so base # your application on resources and use # # link_to "Profile", profile_path(@profile) @@ -348,7 +348,7 @@ module ActionView # Creates a link tag of the given +name+ using a URL created by the set of # +options+ unless the current request URI is the same as the links, in # which case only the name is returned (or the given block is yielded, if - # one exists). You can give +link_to_unless_current+ a block which will + # one exists). You can give +link_to_unless_current+ a block which will # specialize the default behavior (e.g., show a "Start Here" link rather # than the link's text). # @@ -375,7 +375,7 @@ module ActionView # # # The implicit block given to +link_to_unless_current+ is evaluated if the current - # action is the action given. So, if we had a comments page and wanted to render a + # action is the action given. So, if we had a comments page and wanted to render a # "Go Back" link instead of a link to the comments page, we could do something like this... # # <%= @@ -579,7 +579,7 @@ module ActionView url_string = url_for(options) # We ignore any extra parameters in the request_uri if the - # submitted url doesn't have any either. This lets the function + # submitted url doesn't have any either. This lets the function # work with things like ?order=asc if url_string.index("?") request_uri = request.fullpath @@ -641,7 +641,7 @@ module ActionView # Processes the +html_options+ hash, converting the boolean # attributes from true/false form into the form required by - # HTML/XHTML. (An attribute is considered to be boolean if + # HTML/XHTML. (An attribute is considered to be boolean if # its name is listed in the given +bool_attrs+ array.) # # More specifically, for each boolean attribute in +html_options+ @@ -651,7 +651,7 @@ module ActionView # # if the associated +bool_value+ evaluates to true, it is # replaced with the attribute's name; otherwise the attribute is - # removed from the +html_options+ hash. (See the XHTML 1.0 spec, + # removed from the +html_options+ hash. (See the XHTML 1.0 spec, # section 4.5 "Attribute Minimization" for more: # http://www.w3.org/TR/xhtml1/#h-4.5) # From 5d0d4d8ad33be90e34721090991c86c8a22f2d05 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 20:24:04 -0300 Subject: [PATCH 23/47] Remove extra white spaces on ActionMailer docs. --- actionmailer/lib/action_mailer/base.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index f00a0c8ae0..8c6c1cdf04 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -216,7 +216,7 @@ module ActionMailer #:nodoc: # # = Observing and Intercepting Mails # - # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to + # Action Mailer provides hooks into the Mail observer and interceptor methods. These allow you to # register objects that are called during the mail delivery life cycle. # # An observer object must implement the :delivered_email(message) method which will be @@ -224,7 +224,7 @@ module ActionMailer #:nodoc: # # An interceptor object must implement the :delivering_email(message) method which will be # called before the email is sent, allowing you to make modifications to the email before it hits - # the delivery agents. Your object should make any needed modifications directly to the passed + # the delivery agents. Your object should make any needed modifications directly to the passed # in Mail::Message instance. # # = Default Hash @@ -315,11 +315,11 @@ module ActionMailer #:nodoc: # # * delivery_method - Defines a delivery method. Possible values are :smtp (default), # :sendmail, :test, and :file. Or you may provide a custom delivery method - # object eg. MyOwnDeliveryMethodClass.new. See the Mail gem documentation on the interface you need to + # object eg. MyOwnDeliveryMethodClass.new. See the Mail gem documentation on the interface you need to # implement for a custom delivery agent. # # * perform_deliveries - Determines whether emails are actually sent from Action Mailer when you - # call .deliver on an mail message or on an Action Mailer method. This is on by default but can + # call .deliver on an mail message or on an Action Mailer method. This is on by default but can # be turned off to aid in functional testing. # # * deliveries - Keeps an array of all the emails sent out through the Action Mailer with @@ -335,7 +335,7 @@ module ActionMailer #:nodoc: # to set the default +:mime_version+. # # * default_implicit_parts_order - This is now deprecated, use the +default+ method above - # to set the default +:parts_order+. Parts Order is used when a message is built implicitly + # to set the default +:parts_order+. Parts Order is used when a message is built implicitly # (i.e. multiple parts are assembled from templates which specify the content type in their # filenames) this variable controls how the parts are ordered. class Base < AbstractController::Base @@ -567,8 +567,8 @@ module ActionMailer #:nodoc: # method. # # When a :return_path is specified as header, that value will be used as the 'envelope from' - # address for the Mail message. Setting this is useful when you want delivery notifications - # sent to a different address than the one in :from. Mail will actually use the + # address for the Mail message. Setting this is useful when you want delivery notifications + # sent to a different address than the one in :from. Mail will actually use the # :return_path in preference to the :sender in preference to the :from # field for the 'envelope from' value. # From 2a4b780ab1b97b939524f3240b6886c2b77979d2 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 20:39:10 -0300 Subject: [PATCH 24/47] Remove extra white spaces on ActiveModel docs. --- activemodel/lib/active_model/callbacks.rb | 2 +- activemodel/lib/active_model/errors.rb | 6 +++--- activemodel/lib/active_model/observer_array.rb | 6 +++--- activemodel/lib/active_model/serialization.rb | 2 +- activemodel/lib/active_model/serializers/xml.rb | 4 ++-- activemodel/lib/active_model/validations.rb | 2 +- activemodel/lib/active_model/validations/acceptance.rb | 2 +- activemodel/lib/active_model/validations/confirmation.rb | 2 +- activemodel/lib/active_model/validations/exclusion.rb | 4 ++-- activemodel/lib/active_model/validations/format.rb | 4 ++-- activemodel/lib/active_model/validations/inclusion.rb | 4 ++-- activemodel/lib/active_model/validations/length.rb | 6 +++--- activemodel/lib/active_model/validations/numericality.rb | 4 ++-- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index 2a1f51a9a7..37d0c9a0b9 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -59,7 +59,7 @@ module ActiveModel # define_model_callbacks :initializer, :only => :after # # Note, the :only => hash will apply to all callbacks defined on - # that method call. To get around this you can call the define_model_callbacks + # that method call. To get around this you can call the define_model_callbacks # method as many times as you need. # # define_model_callbacks :create, :only => :after diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 22ca3efa2b..0e2a2fd5e2 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -49,8 +49,8 @@ module ActiveModel # # The last three methods are required in your object for Errors to be # able to generate error messages correctly and also handle multiple - # languages. Of course, if you extend your object with ActiveModel::Translations - # you will not need to implement the last two. Likewise, using + # languages. Of course, if you extend your object with ActiveModel::Translations + # you will not need to implement the last two. Likewise, using # ActiveModel::Validations will handle the validation related methods # for you. # @@ -117,7 +117,7 @@ module ActiveModel end # Iterates through each error key, value pair in the error messages hash. - # Yields the attribute and the error for that attribute. If the attribute + # Yields the attribute and the error for that attribute. If the attribute # has more than one error message, yields once for each error message. # # p.errors.add(:name, "can't be blank") diff --git a/activemodel/lib/active_model/observer_array.rb b/activemodel/lib/active_model/observer_array.rb index 5fb73f1c78..3d463885be 100644 --- a/activemodel/lib/active_model/observer_array.rb +++ b/activemodel/lib/active_model/observer_array.rb @@ -15,7 +15,7 @@ module ActiveModel disabled_observers.include?(observer.class) end - # Disables one or more observers. This supports multiple forms: + # Disables one or more observers. This supports multiple forms: # # ORM.observers.disable :user_observer # # => disables the UserObserver @@ -38,7 +38,7 @@ module ActiveModel set_enablement(false, observers, &block) end - # Enables one or more observers. This supports multiple forms: + # Enables one or more observers. This supports multiple forms: # # ORM.observers.enable :user_observer # # => enables the UserObserver @@ -59,7 +59,7 @@ module ActiveModel # # just the duration of the block # end # - # Note: all observers are enabled by default. This method is only + # Note: all observers are enabled by default. This method is only # useful when you have previously disabled one or more observers. def enable(*observers, &block) set_enablement(true, observers, &block) diff --git a/activemodel/lib/active_model/serialization.rb b/activemodel/lib/active_model/serialization.rb index caf44a2ee0..4a174cb62a 100644 --- a/activemodel/lib/active_model/serialization.rb +++ b/activemodel/lib/active_model/serialization.rb @@ -31,7 +31,7 @@ module ActiveModel # you want to serialize and their current value. # # Most of the time though, you will want to include the JSON or XML - # serializations. Both of these modules automatically include the + # serializations. Both of these modules automatically include the # ActiveModel::Serialization module, so there is no need to explicitly # include it. # diff --git a/activemodel/lib/active_model/serializers/xml.rb b/activemodel/lib/active_model/serializers/xml.rb index eb3975f86b..f6aae24324 100644 --- a/activemodel/lib/active_model/serializers/xml.rb +++ b/activemodel/lib/active_model/serializers/xml.rb @@ -55,10 +55,10 @@ module ActiveModel end # To replicate the behavior in ActiveRecord#attributes, :except - # takes precedence over :only. If :only is not set + # takes precedence over :only. If :only is not set # for a N level model but is set for the N+1 level models, # then because :except is set to a default value, the second - # level model can have both :except and :only set. So if + # level model can have both :except and :only set. So if # :only is set, always delete :except. def attributes_hash attributes = @serializable.attributes diff --git a/activemodel/lib/active_model/validations.rb b/activemodel/lib/active_model/validations.rb index 5e567307f3..8ed392abca 100644 --- a/activemodel/lib/active_model/validations.rb +++ b/activemodel/lib/active_model/validations.rb @@ -81,7 +81,7 @@ module ActiveModel # 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 # not occur (e.g. :unless => :skip_validation, or - # :unless => Proc.new { |user| user.signup_step <= 2 }). The + # :unless => Proc.new { |user| user.signup_step <= 2 }). The # method, proc or string should return or evaluate to a true or false value. def validates_each(*attr_names, &block) options = attr_names.extract_options!.symbolize_keys diff --git a/activemodel/lib/active_model/validations/acceptance.rb b/activemodel/lib/active_model/validations/acceptance.rb index 4f390613aa..01907ac9da 100644 --- a/activemodel/lib/active_model/validations/acceptance.rb +++ b/activemodel/lib/active_model/validations/acceptance.rb @@ -49,7 +49,7 @@ module ActiveModel # before validation. # * :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 + # 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 diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index e6d10cfff8..a9dcb0b505 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -50,7 +50,7 @@ module ActiveModel # and :update. # * :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 + # 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 diff --git a/activemodel/lib/active_model/validations/exclusion.rb b/activemodel/lib/active_model/validations/exclusion.rb index a85c23f725..ab4de3c459 100644 --- a/activemodel/lib/active_model/validations/exclusion.rb +++ b/activemodel/lib/active_model/validations/exclusion.rb @@ -54,10 +54,10 @@ module ActiveModel # 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 - # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The + # 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 - # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The + # 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. def validates_exclusion_of(*attr_names) validates_with ExclusionValidator, _merge_attributes(attr_names) diff --git a/activemodel/lib/active_model/validations/format.rb b/activemodel/lib/active_model/validations/format.rb index 6f23d492eb..090e8cfbae 100644 --- a/activemodel/lib/active_model/validations/format.rb +++ b/activemodel/lib/active_model/validations/format.rb @@ -79,10 +79,10 @@ module ActiveModel # 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 - # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The + # 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 - # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The + # 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. def validates_format_of(*attr_names) validates_with FormatValidator, _merge_attributes(attr_names) diff --git a/activemodel/lib/active_model/validations/inclusion.rb b/activemodel/lib/active_model/validations/inclusion.rb index d32aebeb88..bfb65d2f3f 100644 --- a/activemodel/lib/active_model/validations/inclusion.rb +++ b/activemodel/lib/active_model/validations/inclusion.rb @@ -54,10 +54,10 @@ module ActiveModel # 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 - # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The + # 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 - # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The + # 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. def validates_inclusion_of(*attr_names) validates_with InclusionValidator, _merge_attributes(attr_names) diff --git a/activemodel/lib/active_model/validations/length.rb b/activemodel/lib/active_model/validations/length.rb index d595a5fb43..48d14978fa 100644 --- a/activemodel/lib/active_model/validations/length.rb +++ b/activemodel/lib/active_model/validations/length.rb @@ -83,15 +83,15 @@ module ActiveModel # * :too_long - The error message if the attribute goes over the maximum (default is: "is too long (maximum is %{count} characters)"). # * :too_short - The error message if the attribute goes under the minimum (default is: "is too short (min is %{count} characters)"). # * :wrong_length - The error message if using the :is method and the attribute is the wrong size (default is: "is the wrong length (should be %{count} characters)"). - # * :message - The error message to use for a :minimum, :maximum, or :is violation. An alias of the appropriate too_long/too_short/wrong_length message. + # * :message - The error message to use for a :minimum, :maximum, or :is violation. An alias of the appropriate too_long/too_short/wrong_length message. # * :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 - # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The + # 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 - # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The + # 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. # * :tokenizer - Specifies how to split up the attribute string. (e.g. :tokenizer => lambda {|str| str.scan(/\w+/)} to # count words as in above example.) diff --git a/activemodel/lib/active_model/validations/numericality.rb b/activemodel/lib/active_model/validations/numericality.rb index 42556c80a9..0d1903362c 100644 --- a/activemodel/lib/active_model/validations/numericality.rb +++ b/activemodel/lib/active_model/validations/numericality.rb @@ -102,10 +102,10 @@ module ActiveModel # * :odd - Specifies the value must be an odd number. # * :even - Specifies the value must be an even number. # * :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 + # 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 - # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The + # 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. # # The following checks can also be supplied with a proc or a symbol which corresponds to a method: From 0034b7822d6132f5945b0514a5391d18e52aa4b6 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 20:58:25 -0300 Subject: [PATCH 25/47] Remove extra white spaces on ActiveRecord docs. --- activerecord/lib/active_record/aggregations.rb | 2 +- .../associations/collection_association.rb | 2 +- .../associations/has_many_association.rb | 2 +- .../active_record/attribute_methods/read.rb | 2 +- .../lib/active_record/autosave_association.rb | 2 +- .../abstract/connection_pool.rb | 2 +- .../abstract/database_statements.rb | 4 ++-- .../abstract/schema_statements.rb | 6 +++--- .../connection_adapters/mysql_adapter.rb | 4 ++-- .../connection_adapters/postgresql_adapter.rb | 4 ++-- .../lib/active_record/counter_cache.rb | 2 +- activerecord/lib/active_record/fixtures.rb | 12 ++++++------ .../migration/command_recorder.rb | 6 +++--- activerecord/lib/active_record/reflection.rb | 2 +- activerecord/lib/active_record/relation.rb | 4 ++-- .../lib/active_record/relation/calculations.rb | 8 ++++---- .../active_record/relation/finder_methods.rb | 2 +- activerecord/lib/active_record/result.rb | 2 +- .../lib/active_record/schema_dumper.rb | 2 +- .../serializers/xml_serializer.rb | 2 +- .../lib/active_record/session_store.rb | 18 +++++++++--------- activerecord/lib/active_record/test_case.rb | 2 +- activerecord/lib/active_record/validations.rb | 2 +- .../active_record/validations/associated.rb | 4 ++-- .../active_record/validations/uniqueness.rb | 4 ++-- 25 files changed, 51 insertions(+), 51 deletions(-) diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 90d3b58c78..81ddbba51e 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -176,7 +176,7 @@ module ActiveRecord # order in which mappings are defined determine the order in which attributes are sent to the # value class constructor. # * :allow_nil - Specifies that the value object will not be instantiated when all mapped - # attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all + # attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all # mapped attributes. # This defaults to +false+. # * :constructor - A symbol specifying the name of the constructor method or a Proc that diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index 902ad8cb64..8a028c8996 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -126,7 +126,7 @@ module ActiveRecord record end - # Add +records+ to this association. Returns +self+ so method calls may be chained. + # Add +records+ to this association. Returns +self+ so method calls may be chained. # Since << flattens its argument list and inserts each record, +push+ and +concat+ behave identically. def concat(*records) result = true diff --git a/activerecord/lib/active_record/associations/has_many_association.rb b/activerecord/lib/active_record/associations/has_many_association.rb index 78c5c4b870..7172e89a05 100644 --- a/activerecord/lib/active_record/associations/has_many_association.rb +++ b/activerecord/lib/active_record/associations/has_many_association.rb @@ -18,7 +18,7 @@ module ActiveRecord # # If the association has a counter cache it gets that value. Otherwise # it will attempt to do a count via SQL, bounded to :limit if - # there's one. Some configuration options like :group make it impossible + # there's one. Some configuration options like :group make it impossible # to do an SQL count, in those cases the array count will be used. # # That does not depend on whether the collection has already been loaded diff --git a/activerecord/lib/active_record/attribute_methods/read.rb b/activerecord/lib/active_record/attribute_methods/read.rb index aef99e3129..7d4182291a 100644 --- a/activerecord/lib/active_record/attribute_methods/read.rb +++ b/activerecord/lib/active_record/attribute_methods/read.rb @@ -58,7 +58,7 @@ module ActiveRecord generated_attribute_methods.module_eval("def _#{attr_name}; #{access_code}; end; alias #{attr_name} _#{attr_name}", __FILE__, __LINE__) end - # Define an attribute reader method. Cope with nil column. + # Define an attribute reader method. Cope with nil column. # method_name is the same as attr_name except when a non-standard primary key is used, # we still define #id as an accessor for the key def define_read_method(method_name, attr_name, column) diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index 48dbe0838a..036d514a03 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -161,7 +161,7 @@ module ActiveRecord # # For performance reasons, we don't check whether to validate at runtime. # However the validation and callback methods are lazy and those methods - # get created when they are invoked for the very first time. However, + # get created when they are invoked for the very first time. However, # this can change, for instance, when using nested attributes, which is # called _after_ the association has been defined. Since we don't want # the callbacks to get defined multiple times, there are guards that diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index 6f21cea288..c2f051c33a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -165,7 +165,7 @@ module ActiveRecord checkin conn if conn end - # If a connection already exists yield it to the block. If no connection + # If a connection already exists yield it to the block. If no connection # exists checkout a connection, yield it to the block, and checkin the # connection when finished. def with_connection diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index b3eb23bbb3..79134a0f27 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -42,7 +42,7 @@ module ActiveRecord undef_method :execute # Executes +sql+ statement in the context of this connection using - # +binds+ as the bind substitutes. +name+ is logged along with + # +binds+ as the bind substitutes. +name+ is logged along with # the executed +sql+ statement. def exec_query(sql, name = 'SQL', binds = []) end @@ -276,7 +276,7 @@ module ActiveRecord # Set the sequence to the max value of the table's column. def reset_sequence!(table, column, sequence = nil) - # Do nothing by default. Implement for PostgreSQL, Oracle, ... + # Do nothing by default. Implement for PostgreSQL, Oracle, ... end # Inserts the given fixture into the table. Overridden in adapters that require 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 9f9c2c42cb..2e6416412e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -4,7 +4,7 @@ module ActiveRecord module ConnectionAdapters # :nodoc: module SchemaStatements # Returns a Hash of mappings from the abstract data types to the native - # database types. See TableDefinition#column for details on the recognized + # database types. See TableDefinition#column for details on the recognized # abstract data types. def native_database_types {} @@ -78,7 +78,7 @@ module ActiveRecord # Creates a new table with the name +table_name+. +table_name+ may either # be a String or a Symbol. # - # There are two ways to work with +create_table+. You can use the block + # There are two ways to work with +create_table+. You can use the block # form or the regular form, like this: # # === Block form @@ -299,7 +299,7 @@ module ActiveRecord raise NotImplementedError, "rename_column is not implemented" end - # Adds a new index to the table. +column_name+ can be a single Symbol, or + # Adds a new index to the table. +column_name+ can be a single Symbol, or # an Array of Symbols. # # The index will be named after the table and the first column name, diff --git a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb index a9f4c08348..a7ad85e477 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb @@ -407,7 +407,7 @@ module ActiveRecord def exec_without_stmt(sql, name = 'SQL') # :nodoc: # Some queries, like SHOW CREATE TABLE don't work through the prepared - # statement API. For those queries, we need to use this method. :'( + # statement API. For those queries, we need to use this method. :'( log(sql, name) do result = @connection.query(sql) cols = [] @@ -833,7 +833,7 @@ module ActiveRecord stmt.execute(*binds.map { |col, val| type_cast(val, col) }) rescue Mysql::Error => e # Older versions of MySQL leave the prepared statement in a bad - # place when an error occurs. To support older mysql versions, we + # place when an error occurs. To support older mysql versions, we # need to close the statement and delete the statement from the # cache. stmt.close diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 0a460bc086..9e7b3d5449 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -199,7 +199,7 @@ module ActiveRecord # * :password - Defaults to nothing. # * :database - The name of the database. No default, must be provided. # * :schema_search_path - An optional schema search path for the connection given - # as a string of comma-separated schema names. This is backward-compatible with the :schema_order option. + # as a string of comma-separated schema names. This is backward-compatible with the :schema_order option. # * :encoding - An optional client encoding that is used in a SET client_encoding TO # call on the connection. # * :min_messages - An optional client min messages that is used in a @@ -619,7 +619,7 @@ module ActiveRecord create_database(name) end - # Create a new PostgreSQL database. Options include :owner, :template, + # Create a new PostgreSQL database. Options include :owner, :template, # :encoding, :tablespace, and :connection_limit (note that MySQL uses # :charset while PostgreSQL uses :encoding). # diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb index 7839f03848..4d387565d9 100644 --- a/activerecord/lib/active_record/counter_cache.rb +++ b/activerecord/lib/active_record/counter_cache.rb @@ -2,7 +2,7 @@ module ActiveRecord # = Active Record Counter Cache module CounterCache # Resets one or more counter caches to their correct value using an SQL - # count query. This is useful when adding new counter caches, or if the + # count query. This is useful when adding new counter caches, or if the # counter has been corrupted or modified directly by SQL. # # ==== Parameters diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 4aa6389a04..ba9dcf6936 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -54,14 +54,14 @@ class FixturesFileNotFound < StandardError; end # name: Google # url: http://www.google.com # -# This YAML fixture file includes two fixtures. Each YAML fixture (ie. record) is given a name and is followed by an -# indented list of key/value pairs in the "key: value" format. Records are separated by a blank line for your viewing +# This YAML fixture file includes two fixtures. Each YAML fixture (ie. record) is given a name and is followed by an +# indented list of key/value pairs in the "key: value" format. Records are separated by a blank line for your viewing # pleasure. # # Note that YAML fixtures are unordered. If you want ordered fixtures, use the omap YAML type. # See http://yaml.org/type/omap.html -# for the specification. You will need ordered fixtures when you have foreign key constraints on keys in the same table. -# This is commonly needed for tree structures. Example: +# for the specification. You will need ordered fixtures when you have foreign key constraints on keys in the same table. +# This is commonly needed for tree structures. Example: # # --- !omap # - parent: @@ -75,7 +75,7 @@ class FixturesFileNotFound < StandardError; end # # = Using fixtures in testcases # -# Since fixtures are a testing construct, we use them in our unit and functional tests. There are two ways to use the +# Since fixtures are a testing construct, we use them in our unit and functional tests. There are two ways to use the # fixtures, but first let's take a look at a sample unit test: # # require 'test_helper' @@ -558,7 +558,7 @@ module ActiveRecord fixtures.size end - # Return a hash of rows to be inserted. The key is the table, the value is + # Return a hash of rows to be inserted. The key is the table, the value is # a list of rows to insert to that table. def table_rows now = ActiveRecord::Base.default_timezone == :utc ? Time.now.utc : Time.now diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index c9d57ce812..f9f7448008 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -1,7 +1,7 @@ module ActiveRecord class Migration # ActiveRecord::Migration::CommandRecorder records commands done during - # a migration and knows how to reverse those commands. The CommandRecorder + # a migration and knows how to reverse those commands. The CommandRecorder # knows how to invert the following commands: # # * add_column @@ -20,7 +20,7 @@ module ActiveRecord @delegate = delegate end - # record +command+. +command+ should be a method name and arguments. + # record +command+. +command+ should be a method name and arguments. # For example: # # recorder.record(:method_name, [:arg1, arg2]) @@ -29,7 +29,7 @@ module ActiveRecord end # Returns a list that represents commands that are the inverse of the - # commands stored in +commands+. For example: + # commands stored in +commands+. For example: # # recorder.record(:rename_table, [:old, :new]) # recorder.inverse # => [:rename_table, [:new, :old]] diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index bcba85d7a4..bbff7c015e 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -380,7 +380,7 @@ module ActiveRecord class ThroughReflection < AssociationReflection #:nodoc: delegate :foreign_key, :foreign_type, :association_foreign_key, :active_record_primary_key, :to => :source_reflection - # Gets the source of the through reflection. It checks both a singularized + # Gets the source of the through reflection. It checks both a singularized # and pluralized form for :belongs_to or :has_many. # # class Post < ActiveRecord::Base diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index ae9afad48a..8f801e6dad 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -287,7 +287,7 @@ module ActiveRecord end # Destroy an object (or multiple objects) that has the given id, the object is instantiated first, - # therefore all callbacks and filters are fired off before the object is deleted. This method is + # therefore all callbacks and filters are fired off before the object is deleted. This method is # less efficient than ActiveRecord#delete but allows cleanup methods and other actions to be run. # # This essentially finds the object (or multiple objects) with the given id, creates a new object @@ -316,7 +316,7 @@ module ActiveRecord # Deletes the records matching +conditions+ without instantiating the records first, and hence not # calling the +destroy+ method nor invoking callbacks. This is a single SQL DELETE statement that # goes straight to the database, much more efficient than +destroy_all+. Be careful with relations - # though, in particular :dependent rules defined on associations are not honored. Returns + # though, in particular :dependent rules defined on associations are not honored. Returns # the number of rows affected. # # ==== Parameters diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 0fcae92d51..a785f38e89 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -66,7 +66,7 @@ module ActiveRecord calculate(:average, column_name, options) end - # Calculates the minimum value on a given column. The value is returned + # Calculates the minimum value on a given column. The value is returned # with the same data type of the column, or +nil+ if there's no row. See # +calculate+ for examples with options. # @@ -93,7 +93,7 @@ module ActiveRecord calculate(:sum, column_name, options) end - # This calculates aggregate values in the given column. Methods for count, sum, average, + # This calculates aggregate values in the given column. Methods for count, sum, average, # minimum, and maximum have been added as shortcuts. Options such as :conditions, # :order, :group, :having, and :joins can be passed to customize the query. # @@ -101,7 +101,7 @@ module ActiveRecord # * Single aggregate value: The single value is type cast to Fixnum for COUNT, Float # for AVG, and the given column's type for everything else. # * Grouped values: This returns an ordered hash of the values and groups them by the - # :group option. It takes either a column name, or the name of a belongs_to association. + # :group option. It takes either a column name, or the name of a belongs_to association. # # values = Person.maximum(:age, :group => 'last_name') # puts values["Drake"] @@ -119,7 +119,7 @@ module ActiveRecord # Options: # * :conditions - An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. # See conditions in the intro to ActiveRecord::Base. - # * :include: Eager loading, see Associations for details. Since calculations don't load anything, + # * :include: Eager loading, see Associations for details. Since calculations don't load anything, # the purpose of this is to access fields on joined tables in your conditions, order, or group clauses. # * :joins - An SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id". # (Rarely needed). diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 32d1cff6c3..35c72f9536 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -83,7 +83,7 @@ module ActiveRecord # # Example for find with a lock: Imagine two concurrent transactions: # each will read person.visits == 2, add 1 to it, and save, resulting - # in two saves of person.visits = 3. By locking the row, the second + # in two saves of person.visits = 3. By locking the row, the second # transaction has to wait until the first is finished; we get the # expected person.visits == 4. # diff --git a/activerecord/lib/active_record/result.rb b/activerecord/lib/active_record/result.rb index 243012f88c..9ceab2eabc 100644 --- a/activerecord/lib/active_record/result.rb +++ b/activerecord/lib/active_record/result.rb @@ -1,7 +1,7 @@ module ActiveRecord ### # This class encapsulates a Result returned from calling +exec_query+ on any - # database connection adapter. For example: + # database connection adapter. For example: # # x = ActiveRecord::Base.connection.exec_query('SELECT * FROM foo') # x # => # diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index a893c0ad85..62e6999736 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -106,7 +106,7 @@ HEADER spec = {} spec[:name] = column.name.inspect - # AR has an optimisation which handles zero-scale decimals as integers. This + # AR has an optimisation which handles zero-scale decimals as integers. This # code ensures that the dumper still dumps the column as a decimal. spec[:type] = if column.type == :integer && [/^numeric/, /^decimal/].any? { |e| e.match(column.sql_type) } 'decimal' diff --git a/activerecord/lib/active_record/serializers/xml_serializer.rb b/activerecord/lib/active_record/serializers/xml_serializer.rb index 8c4adf7116..f8e6cf958c 100644 --- a/activerecord/lib/active_record/serializers/xml_serializer.rb +++ b/activerecord/lib/active_record/serializers/xml_serializer.rb @@ -75,7 +75,7 @@ module ActiveRecord #:nodoc: # # # Additionally, the record being serialized will be passed to a Proc's second - # parameter. This allows for ad hoc additions to the resultant document that + # parameter. This allows for ad hoc additions to the resultant document that # incorporate the context of the record being serialized. And by leveraging the # closure created by a Proc, to_xml can be used to add elements that normally fall # outside of the scope of the model -- for example, generating and appending URLs diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb index c3e976002e..929559c3ba 100644 --- a/activerecord/lib/active_record/session_store.rb +++ b/activerecord/lib/active_record/session_store.rb @@ -1,7 +1,7 @@ module ActiveRecord # = Active Record Session Store # - # A session store backed by an Active Record class. A default class is + # A session store backed by an Active Record class. A default class is # provided, but any object duck-typing to an Active Record Session class # with text +session_id+ and +data+ attributes is sufficient. # @@ -23,7 +23,7 @@ module ActiveRecord # ActiveRecord::SessionStore::Session.data_column_name = 'legacy_session_data' # # Note that setting the primary key to the +session_id+ frees you from - # having a separate +id+ column if you don't want it. However, you must + # having a separate +id+ column if you don't want it. However, you must # set session.model.id = session.session_id by hand! A before filter # on ApplicationController is a good place. # @@ -46,7 +46,7 @@ module ActiveRecord # save # destroy # - # The example SqlBypass class is a generic SQL session store. You may + # The example SqlBypass class is a generic SQL session store. You may # use it as a basis for high-performance database-specific stores. class SessionStore < ActionDispatch::Session::AbstractStore module ClassMethods # :nodoc: @@ -79,7 +79,7 @@ module ActiveRecord ## # :singleton-method: - # Customizable data column name. Defaults to 'data'. + # Customizable data column name. Defaults to 'data'. cattr_accessor :data_column_name self.data_column_name = 'data' @@ -161,12 +161,12 @@ module ActiveRecord end # A barebones session store which duck-types with the default session - # store but bypasses Active Record and issues SQL directly. This is + # store but bypasses Active Record and issues SQL directly. This is # an example session model class meant as a basis for your own classes. # # The database connection, table name, and session id and data columns - # are configurable class attributes. Marshaling and unmarshaling - # are implemented as class methods that you may override. By default, + # are configurable class attributes. Marshaling and unmarshaling + # are implemented as class methods that you may override. By default, # marshaling data is # # ActiveSupport::Base64.encode64(Marshal.dump(data)) @@ -176,7 +176,7 @@ module ActiveRecord # Marshal.load(ActiveSupport::Base64.decode64(data)) # # This marshaling behavior is intended to store the widest range of - # binary session data in a +text+ column. For higher performance, + # binary session data in a +text+ column. For higher performance, # store in a +blob+ column instead and forgo the Base64 encoding. class SqlBypass extend ClassMethods @@ -286,7 +286,7 @@ module ActiveRecord end end - # The class used for session storage. Defaults to + # The class used for session storage. Defaults to # ActiveRecord::SessionStore::Session cattr_accessor :session_class self.session_class = Session diff --git a/activerecord/lib/active_record/test_case.rb b/activerecord/lib/active_record/test_case.rb index 0d47eb3338..c61428e104 100644 --- a/activerecord/lib/active_record/test_case.rb +++ b/activerecord/lib/active_record/test_case.rb @@ -13,7 +13,7 @@ module ActiveRecord ActiveRecord::IdentityMap.clear end - # Backport skip to Ruby 1.8. test/unit doesn't support it, so just + # Backport skip to Ruby 1.8. test/unit doesn't support it, so just # make it a noop. unless instance_methods.map(&:to_s).include?("skip") def skip(message) diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 59b6876135..4b075183c3 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -1,7 +1,7 @@ module ActiveRecord # = Active Record RecordInvalid # - # Raised by save! and create! when the record is invalid. Use the + # Raised by save! and create! when the record is invalid. Use the # +record+ method to retrieve the record which did not validate. # # begin diff --git a/activerecord/lib/active_record/validations/associated.rb b/activerecord/lib/active_record/validations/associated.rb index 3a783aeb00..5df85304a2 100644 --- a/activerecord/lib/active_record/validations/associated.rb +++ b/activerecord/lib/active_record/validations/associated.rb @@ -37,10 +37,10 @@ module ActiveRecord # 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 - # occur (e.g. :if => :allow_validation, or :if => Proc.new { |user| user.signup_step > 2 }). The + # 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 - # not occur (e.g. :unless => :skip_validation, or :unless => Proc.new { |user| user.signup_step <= 2 }). The + # 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. def validates_associated(*attr_names) validates_with AssociatedValidator, _merge_attributes(attr_names) diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 4db4105389..484b1d369b 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -83,7 +83,7 @@ module ActiveRecord # validates_uniqueness_of :user_name, :scope => :account_id # end # - # Or even multiple scope parameters. For example, making sure that a teacher can only be on the schedule once + # Or even multiple scope parameters. For example, making sure that a teacher can only be on the schedule once # per semester for a particular class. # # class TeacherSchedule < ActiveRecord::Base @@ -105,7 +105,7 @@ module ActiveRecord # 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 # not occur (e.g. :unless => :skip_validation, or - # :unless => Proc.new { |user| user.signup_step <= 2 }). The method, proc or string should + # :unless => Proc.new { |user| user.signup_step <= 2 }). The method, proc or string should # return or evaluate to a true or false value. # # === Concurrency and integrity From dd6c3676af3fa6019c53a59f62c4fd14966be728 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 23 May 2011 21:00:45 -0300 Subject: [PATCH 26/47] Remove extra white spaces on ActiveSupport docs. --- activesupport/lib/active_support/benchmarkable.rb | 2 +- .../active_support/core_ext/class/inheritable_attributes.rb | 2 +- .../lib/active_support/core_ext/date/calculations.rb | 2 +- activesupport/lib/active_support/core_ext/file/atomic.rb | 2 +- activesupport/lib/active_support/core_ext/kernel/agnostics.rb | 4 ++-- activesupport/lib/active_support/core_ext/kernel/requires.rb | 2 +- activesupport/lib/active_support/core_ext/object/blank.rb | 2 +- activesupport/lib/active_support/dependencies.rb | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb index df62c18f41..21c0296269 100644 --- a/activesupport/lib/active_support/benchmarkable.rb +++ b/activesupport/lib/active_support/benchmarkable.rb @@ -6,7 +6,7 @@ module ActiveSupport # Allows you to measure the execution time of a block # in a template and records the result to the log. Wrap this block around # expensive operations or possible bottlenecks to get a time reading - # for the operation. For example, let's say you thought your file + # for the operation. For example, let's say you thought your file # processing method was taking too long; you could wrap it in a benchmark block. # # <% benchmark "Process data files" do %> diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb index ec475134ef..1650602d24 100644 --- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb @@ -2,7 +2,7 @@ require 'active_support/core_ext/object/duplicable' require 'active_support/core_ext/array/extract_options' require 'active_support/deprecation' -# Retained for backward compatibility. Methods are now included in Class. +# Retained for backward compatibility. Methods are now included in Class. module ClassInheritableAttributes # :nodoc: DEPRECATION_WARNING_MESSAGE = "class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first" end diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index 236055d77a..26a99658cc 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -103,7 +103,7 @@ class Date alias_method :minus_without_duration, :- alias_method :-, :minus_with_duration - # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with + # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with # any of these keys: :years, :months, :weeks, :days. def advance(options) options = options.dup diff --git a/activesupport/lib/active_support/core_ext/file/atomic.rb b/activesupport/lib/active_support/core_ext/file/atomic.rb index 26b73ed442..3645597301 100644 --- a/activesupport/lib/active_support/core_ext/file/atomic.rb +++ b/activesupport/lib/active_support/core_ext/file/atomic.rb @@ -1,5 +1,5 @@ class File - # Write to a file atomically. Useful for situations where you don't + # Write to a file atomically. Useful for situations where you don't # want other processes or threads to see half-written files. # # File.atomic_write("important.file") do |file| diff --git a/activesupport/lib/active_support/core_ext/kernel/agnostics.rb b/activesupport/lib/active_support/core_ext/kernel/agnostics.rb index c0cb4fb427..64837d87aa 100644 --- a/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +++ b/activesupport/lib/active_support/core_ext/kernel/agnostics.rb @@ -1,11 +1,11 @@ class Object # Makes backticks behave (somewhat more) similarly on all platforms. # On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the - # spawned shell prints a message to stderr and sets $?. We emulate + # spawned shell prints a message to stderr and sets $?. We emulate # Unix on the former but not the latter. def `(command) #:nodoc: super rescue Errno::ENOENT => e STDERR.puts "#$0: #{e}" end -end \ No newline at end of file +end diff --git a/activesupport/lib/active_support/core_ext/kernel/requires.rb b/activesupport/lib/active_support/core_ext/kernel/requires.rb index 3bf46271d7..6b149e3813 100644 --- a/activesupport/lib/active_support/core_ext/kernel/requires.rb +++ b/activesupport/lib/active_support/core_ext/kernel/requires.rb @@ -1,7 +1,7 @@ require 'active_support/core_ext/kernel/reporting' module Kernel - # Require a library with fallback to RubyGems. Warnings during library + # Require a library with fallback to RubyGems. Warnings during library # loading are silenced to increase signal/noise for application warnings. def require_library_or_gem(library_name) silence_warnings do diff --git a/activesupport/lib/active_support/core_ext/object/blank.rb b/activesupport/lib/active_support/core_ext/object/blank.rb index fb5abf2aa5..8221dc4abe 100644 --- a/activesupport/lib/active_support/core_ext/object/blank.rb +++ b/activesupport/lib/active_support/core_ext/object/blank.rb @@ -22,7 +22,7 @@ class Object # object.presence is equivalent to object.present? ? object : nil. # # This is handy for any representation of objects where blank is the same - # as not present at all. For example, this simplifies a common check for + # as not present at all. For example, this simplifies a common check for # HTTP POST/query parameters: # # state = params[:state] if params[:state].present? diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index dc10f78104..c361c33162 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -652,7 +652,7 @@ module ActiveSupport #:nodoc: end class LoadingModule #:nodoc: - # Old style environment.rb referenced this method directly. Please note, it doesn't + # Old style environment.rb referenced this method directly. Please note, it doesn't # actually *do* anything any more. def self.root(*args) if defined?(Rails) && Rails.logger From 3540579a0bd5e66047d585f77233917bd6874562 Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Mon, 23 May 2011 21:09:05 -0500 Subject: [PATCH 27/47] Update the MVC explanation in the main README.rdoc file --- README.rdoc | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/README.rdoc b/README.rdoc index c5499ae8ef..b562a20a6f 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,30 +1,35 @@ == Welcome to Rails Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. +database-backed web applications according to the Model-View-Controller pattern. -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. +Understanding the MVC pattern is key to understanding Rails. MVC divides your application +into three layers, each with a specific responsibility. -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in its +The View layer is composed of "templates" that are responsible for providing +appropriate representations of your application's resources. Templates +can come in a variety of formats, but most view templates are HTML with embedded Ruby +code (.erb files). + +The Model layer represents your domain model (such as Account, Product, Person, Post) +and encapsulates the business logic that is specific to your application. In Rails, +database-backed model classes are derived from ActiveRecord::Base. ActiveRecord allows +you to present the data from database rows as objects and embellish these data objects +with business logic methods. Although most Rails models are backed by a database, models +can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as +provided by the ActiveModel module. You can read more about Active Record in its {README}[link:files/activerecord/README_rdoc.html]. -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in its -{README}[link:files/actionpack/README_rdoc.html]. +The Controller layer handles incoming requests HTTP requests (such as Save New Account, +Update Product, Show Post). Controllers are responsible for providing a suitable response +back to the client (usually a web browser, but possibly an JSON or XML API client, etc.). +Controllers manipulate models and render the appropriate view templates to generate the HTTP response. +In Rails, the Controller and View layers are handled together by Action Pack. +These two layers are bundled in a single package due to their heavy interdependence. +This is unlike the relationship between the Active Record and Action Pack which are +independent. Each of these packages can be used independently outside of Rails. You +can read more about Action Pack in its {README}[link:files/actionpack/README_rdoc.html]. == Getting Started From e9f9bf015efb9e576d4d38de57e389f54b631a43 Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Mon, 23 May 2011 22:35:47 -0700 Subject: [PATCH 28/47] Removing extra white-spaces on config/environment/development.rb template --- .../rails/app/templates/config/environments/development.rb.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index 066aa54862..ca2d339e4b 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -2,7 +2,7 @@ # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false From 505e115b4c14837580cb1bd83d5edafc4608e1fa Mon Sep 17 00:00:00 2001 From: Guillermo Iguaran Date: Mon, 23 May 2011 22:38:02 -0700 Subject: [PATCH 29/47] Removed extra white-spaces on config/environment/test.rb template --- .../rails/app/templates/config/environments/test.rb.tt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt index 8d11377211..ee068b0202 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt @@ -2,9 +2,9 @@ # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that + # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! + # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Configure static asset server for tests with Cache-Control for performance From 8f003de2c71eea6d1cbc3dd10f11da07715b8d10 Mon Sep 17 00:00:00 2001 From: Dmytrii Nagirniak Date: Mon, 23 May 2011 22:40:29 -0700 Subject: [PATCH 30/47] fix minor spelling mistakes in comments --- actionpack/lib/action_controller/metal/force_ssl.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_controller/metal/force_ssl.rb b/actionpack/lib/action_controller/metal/force_ssl.rb index eb8ed7dfbd..ed693c5967 100644 --- a/actionpack/lib/action_controller/metal/force_ssl.rb +++ b/actionpack/lib/action_controller/metal/force_ssl.rb @@ -1,12 +1,12 @@ module ActionController - # This module provides a method which will redirects browser to use HTTPS + # This module provides a method which will redirect browser to use HTTPS # protocol. This will ensure that user's sensitive information will be # transferred safely over the internet. You _should_ always force browser # to use HTTPS when you're transferring sensitive information such as # user authentication, account information, or credit card information. # - # Note that if you really concern about your application safety, you might - # consider using +config.force_ssl+ in your configuration config file instead. + # Note that if you are really concerned about your application security, + # you might consider using +config.force_ssl+ in your config file instead. # That will ensure all the data transferred via HTTPS protocol and prevent # user from getting session hijacked when accessing the site under unsecured # HTTP protocol. From bfb9f758ae7671d059828695b4b15eb81c13d7a9 Mon Sep 17 00:00:00 2001 From: "Karunakar (Ruby)" Date: Tue, 24 May 2011 21:12:01 +0530 Subject: [PATCH 31/47] changed http://api.rubyonrails.com to http://api.rubyonrails.org in readme files --- actionmailer/README.rdoc | 2 +- actionpack/README.rdoc | 2 +- activerecord/README.rdoc | 2 +- activeresource/README.rdoc | 2 +- activesupport/README.rdoc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index af9bf40f9e..1f3f52d323 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -153,7 +153,7 @@ Action Mailer is released under the MIT license. API documentation is at -* http://api.rubyonrails.com +* http://api.rubyonrails.org Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here: diff --git a/actionpack/README.rdoc b/actionpack/README.rdoc index 2f3678881d..37e10e364c 100644 --- a/actionpack/README.rdoc +++ b/actionpack/README.rdoc @@ -334,7 +334,7 @@ Action Pack is released under the MIT license. API documentation is at -* http://api.rubyonrails.com +* http://api.rubyonrails.org Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here: diff --git a/activerecord/README.rdoc b/activerecord/README.rdoc index 6b4c85bb93..0d00749901 100644 --- a/activerecord/README.rdoc +++ b/activerecord/README.rdoc @@ -215,7 +215,7 @@ Active Record is released under the MIT license. API documentation is at -* http://api.rubyonrails.com +* http://api.rubyonrails.org Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here: diff --git a/activeresource/README.rdoc b/activeresource/README.rdoc index 4fa11adec5..b03e8c4c25 100644 --- a/activeresource/README.rdoc +++ b/activeresource/README.rdoc @@ -178,7 +178,7 @@ Active Support is released under the MIT license. API documentation is at -* http://api.rubyonrails.com +* http://api.rubyonrails.org Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here: diff --git a/activesupport/README.rdoc b/activesupport/README.rdoc index 8bb15e849a..a38ad76f43 100644 --- a/activesupport/README.rdoc +++ b/activesupport/README.rdoc @@ -26,7 +26,7 @@ Active Support is released under the MIT license. API documentation is at -* http://api.rubyonrails.com +* http://api.rubyonrails.org Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here: From 99dd117d6292b66a60567fd950c7ca2bda7e01f3 Mon Sep 17 00:00:00 2001 From: Mohammad El-Abid Date: Wed, 25 May 2011 02:10:14 -0400 Subject: [PATCH 32/47] Adds outline draft#1 for the Asset Pipeline, please comment if you have thoughts about it! --- railties/guides/source/asset_pipeline.textile | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 railties/guides/source/asset_pipeline.textile diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile new file mode 100644 index 0000000000..9ea1aa9e01 --- /dev/null +++ b/railties/guides/source/asset_pipeline.textile @@ -0,0 +1,29 @@ +h2. Asset Pipeline + +This guide will cover the ideology of the asset pipeline introduced in Rails 3.1. +By referring to this guide you will be able to: + +* Properly organize your application assets +* Understand the benefits of the asset pipline +* Adding a preproccessor to the pipeline +* Package assets with your plugin + +endprologue. + +h3. What Is The Asset Pipeline? + +h4. Why Should I Use it? + +h3. How to Use the Asset Pipeline + +h4. Asset Organization + +h4. Default Files Loaded + +h4. Directives + +h4. Stacking Preproccessors + +h3. Packaging Assets with Your Plugin + +h3. More on Sprockets From 31bb347e77f4def4cbc68eeb4d68af8867ae359d Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 12:51:56 +0530 Subject: [PATCH 33/47] update language env variable name --- .../guides/source/ruby_on_rails_guides_guidelines.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/ruby_on_rails_guides_guidelines.textile b/railties/guides/source/ruby_on_rails_guides_guidelines.textile index 26a5a4c3c9..9ae360a73b 100644 --- a/railties/guides/source/ruby_on_rails_guides_guidelines.textile +++ b/railties/guides/source/ruby_on_rails_guides_guidelines.textile @@ -62,10 +62,10 @@ To force process of all the guides, pass +ALL=1+. It is also recommended that you work with +WARNINGS=1+. This detects duplicate IDs and warns about broken internal links. -If you want to generate guides in languages other than English, you can keep them in a separate directory under +source+ (eg. source/es) and use the +LANGUAGE+ environment variable: +If you want to generate guides in languages other than English, you can keep them in a separate directory under +source+ (eg. source/es) and use the +GUIDES_LANGUAGE+ environment variable: -rake generate_guides LANGUAGE=es +rake generate_guides GUIDES_LANGUAGE=es h3. HTML Validation From 727a5a7c82c049f93cac12fcddeb96a606fb5989 Mon Sep 17 00:00:00 2001 From: Jeff Cohen Date: Wed, 25 May 2011 07:31:45 -0500 Subject: [PATCH 34/47] Replace old wording about http requests --- README.rdoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.rdoc b/README.rdoc index b562a20a6f..5abc6f927c 100644 --- a/README.rdoc +++ b/README.rdoc @@ -20,10 +20,10 @@ can also be ordinary Ruby classes, or Ruby classes that implement a set of inter provided by the ActiveModel module. You can read more about Active Record in its {README}[link:files/activerecord/README_rdoc.html]. -The Controller layer handles incoming requests HTTP requests (such as Save New Account, -Update Product, Show Post). Controllers are responsible for providing a suitable response -back to the client (usually a web browser, but possibly an JSON or XML API client, etc.). -Controllers manipulate models and render the appropriate view templates to generate the HTTP response. +The Controller layer is responsible for handling incoming HTTP requests and providing a +suitable response. Usually this means returning HTML, but Rails controllers can also +generate XML, JSON, PDFs, mobile-specific views, and more. Controllers manipulate models +and render view templates in order to generate the appropriate HTTP response. In Rails, the Controller and View layers are handled together by Action Pack. These two layers are bundled in a single package due to their heavy interdependence. From 542cee3af6f67e047ef689b50535fe2491265bd6 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 16:05:57 +0530 Subject: [PATCH 35/47] fix incorrect textile syntax --- .../guides/source/active_record_validations_callbacks.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 19bd4ad0f1..34347d895f 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -765,8 +765,8 @@ h4. Installing as a plugin $ rails plugin install git://github.com/joelmoss/dynamic_form.git -h4 Installing as a Gem -Add this line on your Gemfile: +h4. Installing as a Gem +Add this line in your Gemfile: gem "dynamic_form" From 45989b816e6131ccd9dc5451c9e75baee6fb704b Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 16:11:31 +0530 Subject: [PATCH 36/47] changes validates_presence_of to newer syntax --- .../active_record_validations_callbacks.textile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 34347d895f..ad80bfb63e 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -367,7 +367,7 @@ If you want to be sure that an association is present, you'll need to test wheth class LineItem < ActiveRecord::Base belongs_to :order - validates_presence_of :order_id + validates :order_id, :presence => true end @@ -523,7 +523,7 @@ You can associate the +:if+ and +:unless+ options with a symbol corresponding to class Order < ActiveRecord::Base - validates_presence_of :card_number, :if => :paid_with_card? + validates :card_number, :presence => true, :if => :paid_with_card? def paid_with_card? payment_type == "card" @@ -537,7 +537,7 @@ You can also use a string that will be evaluated using +eval+ and needs to conta class Person < ActiveRecord::Base - validates_presence_of :surname, :if => "name.nil?" + validates :surname, :presence => true, :if => "name.nil?" end @@ -560,7 +560,7 @@ Sometimes it is useful to have multiple validations use one condition, it can be class User < ActiveRecord::Base with_options :if => :is_admin? do |admin| admin.validates_length_of :password, :minimum => 10 - admin.validates_presence_of :email + admin.validates :email, :presence => true end end @@ -742,9 +742,8 @@ The +size+ method returns the total number of error messages for the object. class Person < ActiveRecord::Base - validates :name, :presence => true + validates :name, :email, :presence => true validates_length_of :name, :minimum => 3 - validates_presence_of :email end person = Person.new @@ -779,7 +778,7 @@ When creating a form with the +form_for+ helper, you can use the +error_messages class Product < ActiveRecord::Base - validates_presence_of :description, :value + validates :description, :value, :presence => true validates_numericality_of :value, :allow_nil => true end @@ -878,7 +877,7 @@ In order to use the available callbacks, you need to register them. You can do t class User < ActiveRecord::Base - validates_presence_of :login, :email + validates :login, :email, :presence => true before_validation :ensure_login_has_a_value @@ -895,7 +894,7 @@ The macro-style class methods can also receive a block. Consider using this styl class User < ActiveRecord::Base - validates_presence_of :login, :email + validates :login, :email, :presence => true before_create do |user| user.name = user.login.capitalize if user.name.blank? From deffc9d048d652b2da9b24a60fb3244cbcd9de55 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 16:19:06 +0530 Subject: [PATCH 37/47] changes validates_uniqueness_of to newer syntax --- .../source/active_record_validations_callbacks.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index ad80bfb63e..d2616e0b8e 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -381,7 +381,7 @@ This helper validates that the attribute's value is unique right before the obje class Account < ActiveRecord::Base - validates_uniqueness_of :email + validates :email, :uniqueness => true end @@ -391,7 +391,7 @@ There is a +:scope+ option that you can use to specify other attributes that are class Holiday < ActiveRecord::Base - validates_uniqueness_of :name, :scope => :year, + validates :name, :uniqueness => true, :scope => :year, :message => "should happen once per year" end @@ -400,7 +400,7 @@ There is also a +:case_sensitive+ option that you can use to define whether the class Person < ActiveRecord::Base - validates_uniqueness_of :name, :case_sensitive => false + validates :name, :uniqueness => true, :case_sensitive => false end @@ -503,7 +503,7 @@ The +:on+ option lets you specify when the validation should happen. The default class Person < ActiveRecord::Base # it will be possible to update email with a duplicated value - validates_uniqueness_of :email, :on => :create + validates :email, :uniqueness => true, :on => :create # it will be possible to create the record with a non-numerical age validates_numericality_of :age, :on => :update From 084750c2d072844d68258d4326ad3f9ae67def8e Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 16:23:16 +0530 Subject: [PATCH 38/47] changes validates_acceptance_of to newer syntax --- .../guides/source/active_record_validations_callbacks.textile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index d2616e0b8e..fdc123fdae 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -171,7 +171,7 @@ Validates that a checkbox on the user interface was checked when a form was subm class Person < ActiveRecord::Base - validates_acceptance_of :terms_of_service + validates :terms_of_service, :acceptance => true end @@ -181,7 +181,7 @@ The default error message for +validates_acceptance_of+ is "_must be accepted_". class Person < ActiveRecord::Base - validates_acceptance_of :terms_of_service, :accept => 'yes' + validates :terms_of_service, :acceptance => true, :accept => 'yes' end From cc10dff1ad8f16386e860bd92fe930d2222ba695 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 21:44:38 +0530 Subject: [PATCH 39/47] changes validates_confirmation_of to newer syntax --- .../source/active_record_validations_callbacks.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index fdc123fdae..618d02c9d3 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -208,7 +208,7 @@ You should use this helper when you have two text fields that should receive exa class Person < ActiveRecord::Base - validates_confirmation_of :email + validates :email, :confirmation => true end @@ -223,8 +223,8 @@ This check is performed only if +email_confirmation+ is not +nil+. To require co class Person < ActiveRecord::Base - validates_confirmation_of :email - validates_presence_of :email_confirmation + validates :email, :confirmation => true + validates :email_confirmation, :presence => true end @@ -547,7 +547,7 @@ Finally, it's possible to associate +:if+ and +:unless+ with a +Proc+ object whi class Account < ActiveRecord::Base - validates_confirmation_of :password, + validates :password, :confirmation => true, :unless => Proc.new { |a| a.password.blank? } end From 34a05a701bb72aca2f482c4005af9cd9ea546afe Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 21:54:23 +0530 Subject: [PATCH 40/47] changes validates_length_of to newer syntax --- ...ctive_record_validations_callbacks.textile | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 618d02c9d3..fbafb23417 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -279,10 +279,10 @@ This helper validates the length of the attributes' values. It provides a variet class Person < ActiveRecord::Base - validates_length_of :name, :minimum => 2 - validates_length_of :bio, :maximum => 500 - validates_length_of :password, :in => 6..20 - validates_length_of :registration_number, :is => 6 + validates :name, :length => { :minimum => 2 } + validates :bio, :length => { :maximum => 500 } + validates :password, :length => { :in => 6..20 } + validates :registration_number, :length => { :is => 6 } end @@ -297,8 +297,8 @@ The default error messages depend on the type of length validation being perform class Person < ActiveRecord::Base - validates_length_of :bio, :maximum => 1000, - :too_long => "%{count} characters is the maximum allowed" + validates :bio, :length => { :maximum => 1000, + :too_long => "%{count} characters is the maximum allowed" } end @@ -306,12 +306,13 @@ This helper counts characters by default, but you can split the value in a diffe class Essay < ActiveRecord::Base - validates_length_of :content, + validates :content, :length => { :minimum => 300, :maximum => 400, :tokenizer => lambda { |str| str.scan(/\w+/) }, :too_short => "must have at least %{count} words", :too_long => "must have at most %{count} words" + } end @@ -483,7 +484,7 @@ The +:allow_blank+ option is similar to the +:allow_nil+ option. This option wil class Topic < ActiveRecord::Base - validates_length_of :title, :is => 5, :allow_blank => true + validates :title, :length => { :is => 5, :allow_blank => true } end Topic.create("title" => "").valid? # => true @@ -559,7 +560,7 @@ Sometimes it is useful to have multiple validations use one condition, it can be class User < ActiveRecord::Base with_options :if => :is_admin? do |admin| - admin.validates_length_of :password, :minimum => 10 + admin.validates :password, :length => { :minimum => 10 } admin.validates :email, :presence => true end end @@ -622,8 +623,7 @@ Returns an OrderedHash with all errors. Each key is the attribute name and the v class Person < ActiveRecord::Base - validates :name, :presence => true - validates_length_of :name, :minimum => 3 + validates :name, :presence => true, :length => { :minimum => 3 } end person = Person.new @@ -642,8 +642,7 @@ h4(#working_with_validation_errors-errors-2). +errors[]+ class Person < ActiveRecord::Base - validates :name, :presence => true - validates_length_of :name, :minimum => 3 + validates :name, :presence => true, :length => { :minimum => 3 } end person = Person.new(:name => "John Doe") @@ -718,8 +717,7 @@ The +clear+ method is used when you intentionally want to clear all the messages class Person < ActiveRecord::Base - validates :name, :presence => true - validates_length_of :name, :minimum => 3 + validates :name, :presence => true, :length => { :minimum => 3 } end person = Person.new @@ -742,8 +740,7 @@ The +size+ method returns the total number of error messages for the object. class Person < ActiveRecord::Base - validates :name, :email, :presence => true - validates_length_of :name, :minimum => 3 + validates :name, :presence => true, :length => { :minimum => 3 } end person = Person.new From f69d5cddf0d05388685b64d42cfa50bbca5b4b80 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 22:04:35 +0530 Subject: [PATCH 41/47] changes validates_inclusion & exclusion to newer syntax --- .../active_record_validations_callbacks.textile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index fbafb23417..b6a2a10460 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -236,8 +236,8 @@ This helper validates that the attributes' values are not included in a given se class Account < ActiveRecord::Base - validates_exclusion_of :subdomain, :in => %w(www us ca jp), - :message => "Subdomain %{value} is reserved." + validates :subdomain, :exclusion => { :in => %w(www us ca jp), + :message => "Subdomain %{value} is reserved." } end @@ -264,8 +264,8 @@ This helper validates that the attributes' values are included in a given set. I class Coffee < ActiveRecord::Base - validates_inclusion_of :size, :in => %w(small medium large), - :message => "%{value} is not a valid size" + validates :size, :inclusion => { :in => %w(small medium large), + :message => "%{value} is not a valid size" } end @@ -471,8 +471,8 @@ The +:allow_nil+ option skips the validation when the value being validated is + class Coffee < ActiveRecord::Base - validates_inclusion_of :size, :in => %w(small medium large), - :message => "%{value} is not a valid size", :allow_nil => true + validates :size, :inclusion => { :in => %w(small medium large), + :message => "%{value} is not a valid size" }, :allow_nil => true end @@ -598,7 +598,7 @@ You can even create your own validation helpers and reuse them in several differ ActiveRecord::Base.class_eval do def self.validates_as_choice(attr_name, n, options={}) - validates_inclusion_of attr_name, {:in => 1..n}.merge(options) + validates attr_name, :inclusion => { {:in => 1..n}.merge(options) } end end From 492f60672c91a1fb9bab1c16a941f87c26444ac8 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 25 May 2011 22:08:14 +0530 Subject: [PATCH 42/47] changes validates_format & numericality to newer syntax --- .../active_record_validations_callbacks.textile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index b6a2a10460..8721ca51c5 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -251,8 +251,8 @@ This helper validates the attributes' values by testing whether they match a giv class Product < ActiveRecord::Base - validates_format_of :legacy_code, :with => /\A[a-zA-Z]+\z/, - :message => "Only letters allowed" + validates :legacy_code, :format => { :with => /\A[a-zA-Z]+\z/, + :message => "Only letters allowed" } end @@ -336,8 +336,8 @@ WARNING. Note that the regular expression above allows a trailing newline charac class Player < ActiveRecord::Base - validates_numericality_of :points - validates_numericality_of :games_played, :only_integer => true + validates :points, :numericality => true + validates :games_played, :numericality => true, :only_integer => true end @@ -507,7 +507,7 @@ class Person < ActiveRecord::Base validates :email, :uniqueness => true, :on => :create # it will be possible to create the record with a non-numerical age - validates_numericality_of :age, :on => :update + validates :age, :numericality => true, :on => :update # the default (validates on both create and update) validates :name, :presence => true, :on => :save @@ -776,7 +776,7 @@ When creating a form with the +form_for+ helper, you can use the +error_messages class Product < ActiveRecord::Base validates :description, :value, :presence => true - validates_numericality_of :value, :allow_nil => true + validates :value, :numericality => true, :allow_nil => true end From ffaefe268184806977d7907243a98870593e4450 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 26 May 2011 00:16:09 +0530 Subject: [PATCH 43/47] fixed minor errors --- .../source/active_record_validations_callbacks.textile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 8721ca51c5..c9b03f169d 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -484,10 +484,10 @@ The +:allow_blank+ option is similar to the +:allow_nil+ option. This option wil class Topic < ActiveRecord::Base - validates :title, :length => { :is => 5, :allow_blank => true } + validates :title, :length => { :is => 5 }, :allow_blank => true end -Topic.create("title" => "").valid? # => true +Topic.create("title" => "").valid? # => true Topic.create("title" => nil).valid? # => true @@ -762,12 +762,13 @@ $ rails plugin install git://github.com/joelmoss/dynamic_form.git h4. Installing as a Gem + Add this line in your Gemfile: gem "dynamic_form" -Now you will have access to these two methods in your view templates: +Now you will have access to these two methods in your view templates. h4. +error_messages+ and +error_messages_for+ From 2c29c40a0d2bf335047388aeadd30b9621fdbafd Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 26 May 2011 00:31:29 +0530 Subject: [PATCH 44/47] prefer validates :x in place of validates_x_of --- ...ctive_record_validations_callbacks.textile | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index c9b03f169d..9f59397d7d 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -165,7 +165,7 @@ Each helper accepts an arbitrary number of attribute names, so with a single lin All of them accept the +:on+ and +:message+ options, which define when the validation should be run and what message should be added to the +errors+ collection if it fails, respectively. The +:on+ option takes one of the values +:save+ (the default), +:create+ or +:update+. There is a default error message for each one of the validation helpers. These messages are used when the +:message+ option isn't specified. Let's take a look at each one of the available helpers. -h4. +validates_acceptance_of+ +h4. +acceptance+ Validates that a checkbox on the user interface was checked when a form was submitted. This is typically used when the user needs to agree to your application's terms of service, confirm reading some text, or any similar concept. This validation is very specific to web applications and this 'acceptance' does not need to be recorded anywhere in your database (if you don't have a field for it, the helper will just create a virtual attribute). @@ -175,9 +175,9 @@ class Person < ActiveRecord::Base end -The default error message for +validates_acceptance_of+ is "_must be accepted_". +The default error message for this helper is "_must be accepted_". -+validates_acceptance_of+ can receive an +:accept+ option, which determines the value that will be considered acceptance. It defaults to "1", but you can change this. +It can receive an +:accept+ option, which determines the value that will be considered acceptance. It defaults to "1" and can be easily changed. class Person < ActiveRecord::Base @@ -202,7 +202,7 @@ CAUTION: Don't use +validates_associated+ on both ends of your associations. The The default error message for +validates_associated+ is "_is invalid_". Note that each associated object will contain its own +errors+ collection; errors do not bubble up to the calling model. -h4. +validates_confirmation_of+ +h4. +confirmation+ You should use this helper when you have two text fields that should receive exactly the same content. For example, you may want to confirm an email address or a password. This validation creates a virtual attribute whose name is the name of the field that has to be confirmed with "_confirmation" appended. @@ -219,7 +219,7 @@ In your view template you could use something like <%= text_field :person, :email_confirmation %>
-This check is performed only if +email_confirmation+ is not +nil+. To require confirmation, make sure to add a presence check for the confirmation attribute (we'll take a look at +validates_presence_of+ later on this guide): +This check is performed only if +email_confirmation+ is not +nil+. To require confirmation, make sure to add a presence check for the confirmation attribute (we'll take a look at +presence+ later on this guide): class Person < ActiveRecord::Base @@ -228,9 +228,9 @@ class Person < ActiveRecord::Base end -The default error message for +validates_confirmation_of+ is "_doesn't match confirmation_". +The default error message for this helper is "_doesn't match confirmation_". -h4. +validates_exclusion_of+ +h4. +exclusion+ This helper validates that the attributes' values are not included in a given set. In fact, this set can be any enumerable object. @@ -241,11 +241,11 @@ class Account < ActiveRecord::Base end -The +validates_exclusion_of+ helper has an option +:in+ that receives the set of values that will not be accepted for the validated attributes. The +:in+ option has an alias called +:within+ that you can use for the same purpose, if you'd like to. This example uses the +:message+ option to show how you can include the attribute's value. +The +exclusion+ helper has an option +:in+ that receives the set of values that will not be accepted for the validated attributes. The +:in+ option has an alias called +:within+ that you can use for the same purpose, if you'd like to. This example uses the +:message+ option to show how you can include the attribute's value. -The default error message for +validates_exclusion_of+ is "_is reserved_". +The default error message is "_is reserved_". -h4. +validates_format_of+ +h4. +format+ This helper validates the attributes' values by testing whether they match a given regular expression, which is specified using the +:with+ option. @@ -256,9 +256,9 @@ class Product < ActiveRecord::Base end -The default error message for +validates_format_of+ is "_is invalid_". +The default error message is "_is invalid_". -h4. +validates_inclusion_of+ +h4. +inclusion+ This helper validates that the attributes' values are included in a given set. In fact, this set can be any enumerable object. @@ -269,11 +269,11 @@ class Coffee < ActiveRecord::Base end -The +validates_inclusion_of+ helper has an option +:in+ that receives the set of values that will be accepted. The +:in+ option has an alias called +:within+ that you can use for the same purpose, if you'd like to. The previous example uses the +:message+ option to show how you can include the attribute's value. +The +inclusion+ helper has an option +:in+ that receives the set of values that will be accepted. The +:in+ option has an alias called +:within+ that you can use for the same purpose, if you'd like to. The previous example uses the +:message+ option to show how you can include the attribute's value. -The default error message for +validates_inclusion_of+ is "_is not included in the list_". +The default error message for this helper is "_is not included in the list_". -h4. +validates_length_of+ +h4. +length+ This helper validates the length of the attributes' values. It provides a variety of options, so you can specify length constraints in different ways: @@ -316,11 +316,11 @@ class Essay < ActiveRecord::Base end -Note that the default error messages are plural (e.g., "is too short (minimum is %{count} characters)"). For this reason, when +:minimum+ is 1 you should provide a personalized message or use +validates_presence_of+ instead. When +:in+ or +:within+ have a lower limit of 1, you should either provide a personalized message or call +validates_presence_of+ prior to +validates_length_of+. +Note that the default error messages are plural (e.g., "is too short (minimum is %{count} characters)"). For this reason, when +:minimum+ is 1 you should provide a personalized message or use +validates_presence_of+ instead. When +:in+ or +:within+ have a lower limit of 1, you should either provide a personalized message or call +presence+ prior to +length+. -The +validates_size_of+ helper is an alias for +validates_length_of+. +The +size+ helper is an alias for +length+. -h4. +validates_numericality_of+ +h4. +numericality+ This helper validates that your attributes have only numeric values. By default, it will match an optional sign followed by an integral or floating point number. To specify that only integral numbers are allowed set +:only_integer+ to true. @@ -341,7 +341,7 @@ class Player < ActiveRecord::Base end -Besides +:only_integer+, the +validates_numericality_of+ helper also accepts the following options to add constraints to acceptable values: +Besides +:only_integer+, this helper also accepts the following options to add constraints to acceptable values: * +:greater_than+ - Specifies the value must be greater than the supplied value. The default error message for this option is "_must be greater than %{count}_". * +:greater_than_or_equal_to+ - Specifies the value must be greater than or equal to the supplied value. The default error message for this option is "_must be greater than or equal to %{count}_". @@ -351,9 +351,9 @@ Besides +:only_integer+, the +validates_numericality_of+ helper also accepts the * +:odd+ - Specifies the value must be an odd number if set to true. The default error message for this option is "_must be odd_". * +:even+ - Specifies the value must be an even number if set to true. The default error message for this option is "_must be even_". -The default error message for +validates_numericality_of+ is "_is not a number_". +The default error message is "_is not a number_". -h4. +validates_presence_of+ +h4. +presence+ This helper validates that the specified attributes are not empty. It uses the +blank?+ method to check if the value is either +nil+ or a blank string, that is, a string that is either empty or consists of whitespace. @@ -372,11 +372,11 @@ class LineItem < ActiveRecord::Base end -Since +false.blank?+ is true, if you want to validate the presence of a boolean field you should use +validates_inclusion_of :field_name, :in => [true, false]+. +Since +false.blank?+ is true, if you want to validate the presence of a boolean field you should use validates :field_name, :inclusion => { :in => [true, false] }. -The default error message for +validates_presence_of+ is "_can't be empty_". +The default error message is "_can't be empty_". -h4. +validates_uniqueness_of+ +h4. +uniqueness+ This helper validates that the attribute's value is unique right before the object gets saved. It does not create a uniqueness constraint in the database, so it may happen that two different database connections create two records with the same value for a column that you intend to be unique. To avoid that, you must create a unique index in your database. @@ -407,7 +407,7 @@ end WARNING. Note that some databases are configured to perform case-insensitive searches anyway. -The default error message for +validates_uniqueness_of+ is "_has already been taken_". +The default error message is "_has already been taken_". h4. +validates_with+ From 29ff12b738280f1f6a2a669cd49ec83125b04fb4 Mon Sep 17 00:00:00 2001 From: Lee Reilly Date: Wed, 25 May 2011 13:14:00 -0700 Subject: [PATCH 45/47] Typo; changed 'enviroment' to 'environment' --- railties/guides/source/configuring.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index fbe3d46367..135c849ec3 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -414,7 +414,7 @@ Rails has 5 initialization events which can be hooked into (listed in order that * +to_prepare+: Run after the initializers are ran for all Railties (including the application itself), but before eager loading and the middleware stack is built. -* +before_eager_load+: This is run directly before eager loading occurs, which is the default behaviour for the _production_ environment and not for the +development+ enviroment. +* +before_eager_load+: This is run directly before eager loading occurs, which is the default behaviour for the _production_ environment and not for the +development+ environment. * +after_initialize+: Run directly after the initialization of the application, but before the application initializers are run. From 1d637d2f4807d806eabb4b518d15e8004b64b9b4 Mon Sep 17 00:00:00 2001 From: Lee Reilly Date: Wed, 25 May 2011 13:15:18 -0700 Subject: [PATCH 46/47] Typo; changed 'colour' to 'color' & 'analysed' to 'analyzed' --- railties/guides/source/security.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/railties/guides/source/security.textile b/railties/guides/source/security.textile index 1a1339137c..412ded1d0b 100644 --- a/railties/guides/source/security.textile +++ b/railties/guides/source/security.textile @@ -540,7 +540,7 @@ Most bots are really dumb, they crawl the web and put their spam into every form Here are some ideas how to hide honeypot fields by JavaScript and/or CSS: * position the fields off of the visible area of the page -* make the elements very small or colour them the same as the background of the page +* make the elements very small or color them the same as the background of the page * leave the fields displayed, but tell humans to leave them blank The most simple negative CAPTCHA is one hidden honeypot field. On the server side, you will check the value of the field: If it contains any text, it must be a bot. Then, you can either ignore the post or return a positive result, but not saving the post to the database. This way the bot will be satisfied and moves on. You can do this with annoying users, too. @@ -567,7 +567,7 @@ h4. Good Passwords -- _Do you find it hard to remember all your passwords? Don't write them down, but use the initial letters of each word in an easy to remember sentence._ -Bruce Schneier, a security technologist, "has analysed":http://www.schneier.com/blog/archives/2006/12/realworld_passw.html 34,000 real-world user names and passwords from the MySpace phishing attack mentioned below. It turns out that most of the passwords are quite easy to crack. The 20 most common passwords are: +Bruce Schneier, a security technologist, "has analyzed":http://www.schneier.com/blog/archives/2006/12/realworld_passw.html 34,000 real-world user names and passwords from the MySpace phishing attack mentioned below. It turns out that most of the passwords are quite easy to crack. The 20 most common passwords are: password1, abc123, myspace1, password, blink182, qwerty1, ****you, 123abc, baseball1, football1, 123456, soccer, monkey1, liverpool1, princess1, jordan23, slipknot1, superman1, iloveyou1, and monkey. @@ -885,7 +885,7 @@ The "moz-binding":http://www.securiteam.com/securitynews/5LP051FHPE.html CSS pro h5(#css-injection-countermeasures). Countermeasures -This example, again, showed that a blacklist filter is never complete. However, as custom CSS in web applications is a quite rare feature, I am not aware of a whitelist CSS filter. _(highlight)If you want to allow custom colours or images, you can allow the user to choose them and build the CSS in the web application_. Use Rails' +sanitize()+ method as a model for a whitelist CSS filter, if you really need one. +This example, again, showed that a blacklist filter is never complete. However, as custom CSS in web applications is a quite rare feature, I am not aware of a whitelist CSS filter. _(highlight)If you want to allow custom colors or images, you can allow the user to choose them and build the CSS in the web application_. Use Rails' +sanitize()+ method as a model for a whitelist CSS filter, if you really need one. h4. Textile Injection From 03f418370a4266e414ff32706381bb2b60baadfc Mon Sep 17 00:00:00 2001 From: Lee Reilly Date: Wed, 25 May 2011 13:15:59 -0700 Subject: [PATCH 47/47] Typo; changed 'Febuary' to 'February' --- railties/guides/source/routing.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile index 99fdcee68a..08615bed4e 100644 --- a/railties/guides/source/routing.textile +++ b/railties/guides/source/routing.textile @@ -880,7 +880,7 @@ h3. Changelog * April 10, 2010: Updated guide to remove outdated and superfluous information, and to provide information about new features, by "Yehuda Katz":http://www.yehudakatz.com * April 2, 2010: Updated guide to match new Routing DSL in Rails 3, by "Rizwan Reza":http://www.rizwanreza.com/ -* Febuary 1, 2010: Modifies the routing documentation to match new routing DSL in Rails 3, by Prem Sichanugrist +* February 1, 2010: Modifies the routing documentation to match new routing DSL in Rails 3, by Prem Sichanugrist * October 4, 2008: Added additional detail on specifying verbs for resource member/collection routes, by "Mike Gunderloy":credits.html#mgunderloy * September 23, 2008: Added section on namespaced controllers and routing, by "Mike Gunderloy":credits.html#mgunderloy * September 10, 2008: initial version by "Mike Gunderloy":credits.html#mgunderloy