From c5647a08b4a6ece80379306d9f148608e2597d83 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Sun, 30 Sep 2012 18:48:22 -0500 Subject: =?UTF-8?q?add=20change=5Ftable=20transformation=20to=20Migration?= =?UTF-8?q?=20docs=C2=A0[ci=20skip]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- activerecord/lib/active_record/migration.rb | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index c1d57855a9..ce9c2fbac0 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -50,7 +50,7 @@ module ActiveRecord # # class AddSsl < ActiveRecord::Migration # def up - # add_column :accounts, :ssl_enabled, :boolean, :default => true + # add_column :accounts, :ssl_enabled, :boolean, default: true # end # # def down @@ -62,7 +62,7 @@ module ActiveRecord # if you're backing out of the migration. It shows how all migrations have # two methods +up+ and +down+ that describes the transformations # required to implement or remove the migration. These methods can consist - # of both the migration specific methods like add_column and remove_column, + # of both the migration specific methods like +add_column+ and +remove_column+, # but may also contain regular Ruby code for generating data needed for the # transformations. # @@ -70,7 +70,7 @@ module ActiveRecord # # class AddSystemSettings < ActiveRecord::Migration # def up - # create_table :system_settings do |t| + # create_table system_settings: do |t| # t.string :name # t.string :label # t.text :value @@ -78,9 +78,9 @@ module ActiveRecord # t.integer :position # end # - # SystemSetting.create :name => "notice", - # :label => "Use notice?", - # :value => 1 + # SystemSetting.create name: 'notice', + # label: 'Use notice?', + # value: 1 # end # # def down @@ -88,19 +88,22 @@ module ActiveRecord # end # end # - # This migration first adds the system_settings table, then creates the very + # This migration first adds the +system_settings+ table, then creates the very # first row in it using the Active Record model that relies on the table. It - # also uses the more advanced create_table syntax where you can specify a + # also uses the more advanced +create_table+ syntax where you can specify a # complete table schema in one block call. # # == Available transformations # - # * create_table(name, options) Creates a table called +name+ and + # * create_table(name, options): Creates a table called +name+ and # makes the table object available to a block that can then add columns to it, - # following the same format as add_column. See example above. The options hash + # following the same format as +add_column+. See example above. The options hash # is for fragments like "DEFAULT CHARSET=UTF-8" that are appended to the create # table definition. # * drop_table(name): Drops the table called +name+. + # * change_table(name, options): Allows to make column alterations to + # the table called +name+. It makes the table object availabe to a block that + # can then add/remove columns, indexes or foreign keys to it. # * rename_table(old_name, new_name): Renames the table called +old_name+ # to +new_name+. # * add_column(table_name, column_name, type, options): Adds a new column @@ -109,9 +112,9 @@ module ActiveRecord # :string, :text, :integer, :float, # :decimal, :datetime, :timestamp, :time, # :date, :binary, :boolean. A default value can be - # specified by passing an +options+ hash like { :default => 11 }. + # specified by passing an +options+ hash like { default: 11 }. # Other options include :limit and :null (e.g. - # { :limit => 50, :null => false }) -- see + # { limit: 50, null: false }) -- see # ActiveRecord::ConnectionAdapters::TableDefinition#column for details. # * rename_column(table_name, column_name, new_column_name): Renames # a column but keeps the type and content. @@ -122,11 +125,11 @@ module ActiveRecord # * add_index(table_name, column_names, options): Adds a new index # with the name of the column. Other options include # :name, :unique (e.g. - # { :name => "users_name_index", :unique => true }) and :order - # (e.g. { :order => {:name => :desc} }). - # * remove_index(table_name, :column => column_name): Removes the index + # { name: 'users_name_index', unique: true }) and :order + # (e.g. { order: { name: :desc } }). + # * remove_index(table_name, column: column_name): Removes the index # specified by +column_name+. - # * remove_index(table_name, :name => index_name): Removes the index + # * remove_index(table_name, name: index_name): Removes the index # specified by +index_name+. # # == Irreversible transformations -- cgit v1.2.3 From 07a3c2103c0db8f960ea2ba2a8748a2fe2bed206 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Sun, 30 Sep 2012 21:01:43 -0500 Subject: fix example in Migration docs [ci skip] --- activerecord/lib/active_record/migration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index ce9c2fbac0..a68663cf53 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -70,7 +70,7 @@ module ActiveRecord # # class AddSystemSettings < ActiveRecord::Migration # def up - # create_table system_settings: do |t| + # create_table :system_settings do |t| # t.string :name # t.string :label # t.text :value -- cgit v1.2.3 From e9020a6ce63e7c3454cd8b14b1c9332c4c915a47 Mon Sep 17 00:00:00 2001 From: Samuel Cochran Date: Fri, 5 Oct 2012 16:14:34 +0800 Subject: Add CollectionAssociation#destroy to ActiveRecord::Association::ClassMethods code docs --- activerecord/lib/active_record/associations.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 258d602afa..69b95f814c 100644 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -190,10 +190,10 @@ module ActiveRecord # * Project#portfolio, Project#portfolio=(portfolio), Project#portfolio.nil? # * Project#project_manager, Project#project_manager=(project_manager), Project#project_manager.nil?, # * Project#milestones.empty?, Project#milestones.size, Project#milestones, Project#milestones<<(milestone), - # Project#milestones.delete(milestone), Project#milestones.find(milestone_id), Project#milestones.all(options), - # Project#milestones.build, Project#milestones.create + # Project#milestones.delete(milestone), Project#milestones.destroy(mileston), Project#milestones.find(milestone_id), + # Project#milestones.all(options), Project#milestones.build, Project#milestones.create # * Project#categories.empty?, Project#categories.size, Project#categories, Project#categories<<(category1), - # Project#categories.delete(category1) + # Project#categories.delete(category1), Project#categories.destroy(category1) # # === A word of warning # @@ -236,6 +236,7 @@ module ActiveRecord # others.clear | X | X | X # others.delete(other,other,...) | X | X | X # others.delete_all | X | X | X + # others.destroy(other,other,...) | X | X | X # others.destroy_all | X | X | X # others.find(*args) | X | X | X # others.exists? | X | X | X @@ -1031,6 +1032,12 @@ module ActiveRecord # If the :through option is used, then the join records are deleted (rather than # nullified) by default, but you can specify :dependent => :destroy or # :dependent => :nullify to override this. + # [collection.destroy(object, ...)] + # Removes one or more objects from the collection by running destroy on + # each record, regardless of any dependent option, ensuring callbacks are run. + # + # If the :through option is used, then the join records are destroyed + # instead, not the objects themselves. # [collection=objects] # Replaces the collections content by deleting and adding objects as appropriate. If the :through # option is true callbacks in the join models are triggered except destroy callbacks, since deletion is @@ -1074,6 +1081,7 @@ module ActiveRecord # * Firm#clients (similar to Clients.all :conditions => ["firm_id = ?", id]) # * Firm#clients<< # * Firm#clients.delete + # * Firm#clients.destroy # * Firm#clients= # * Firm#client_ids # * Firm#client_ids= @@ -1425,6 +1433,9 @@ module ActiveRecord # [collection.delete(object, ...)] # Removes one or more objects from the collection by removing their associations from the join table. # This does not destroy the objects. + # [collection.destroy(object, ...)] + # Removes one or more objects from the collection by running destroy on each association in the join table, overriding any dependent option. + # This does not destroy the objects. # [collection=objects] # Replaces the collection's content by deleting and adding objects as appropriate. # [collection_singular_ids] @@ -1461,6 +1472,7 @@ module ActiveRecord # * Developer#projects # * Developer#projects<< # * Developer#projects.delete + # * Developer#projects.destroy # * Developer#projects= # * Developer#project_ids # * Developer#project_ids= -- cgit v1.2.3 From 9b1853ee4c4f730df9f1418298da1c159b55d545 Mon Sep 17 00:00:00 2001 From: Lincoln Lee Date: Mon, 8 Oct 2012 16:50:56 +0800 Subject: Fix missing typewriter tag --- activerecord/lib/active_record/migration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index a68663cf53..d5ee98382d 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -126,7 +126,7 @@ module ActiveRecord # with the name of the column. Other options include # :name, :unique (e.g. # { name: 'users_name_index', unique: true }) and :order - # (e.g. { order: { name: :desc } }). + # (e.g. { order: { name: :desc } }). # * remove_index(table_name, column: column_name): Removes the index # specified by +column_name+. # * remove_index(table_name, name: index_name): Removes the index -- cgit v1.2.3 From d7ef1c16359da4360d456d1cbb49b79589118f8e Mon Sep 17 00:00:00 2001 From: Jeffrey Hardy Date: Mon, 8 Oct 2012 14:17:38 -0400 Subject: Fix typo: 'this also mean' -> 'this also means' --- activerecord/lib/active_record/relation/batches.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/relation/batches.rb b/activerecord/lib/active_record/relation/batches.rb index 28aab6d92b..8af0c6a8ef 100644 --- a/activerecord/lib/active_record/relation/batches.rb +++ b/activerecord/lib/active_record/relation/batches.rb @@ -40,7 +40,7 @@ module ActiveRecord # # It's not possible to set the order. That is automatically set to # ascending on the primary key ("id ASC") to make the batch ordering - # work. This also mean that this method only works with integer-based + # work. This also means that this method only works with integer-based # primary keys. You can't set the limit either, that's used to control # the batch sizes. # -- cgit v1.2.3 From 28fc89323ce5e5d29fb9254a95cce917a88974c2 Mon Sep 17 00:00:00 2001 From: AvnerCohen Date: Tue, 9 Oct 2012 09:46:09 +0200 Subject: Fixed unclosing tag --- .../lib/active_record/connection_adapters/postgresql_adapter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 5e35f472c7..bd375ad15a 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -241,7 +241,7 @@ module ActiveRecord # call on the connection. # * :min_messages - An optional client min messages that is used in a # SET client_min_messages TO call on the connection. - # * :insert_returning - An optional boolean to control the use or RETURNING for INSERT statements + # * :insert_returning - An optional boolean to control the use or RETURNING for INSERT statements # defaults to true. # # Any further options are used as connection parameters to libpq. See -- cgit v1.2.3 From 2d554313409cf883313df15aecfcbfab4410daee Mon Sep 17 00:00:00 2001 From: Adam Haymond Date: Wed, 10 Oct 2012 10:19:14 -0600 Subject: Added clarity to update_column(s) --- activerecord/lib/active_record/persistence.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index f81eb5f5d1..0107667fbe 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -197,7 +197,7 @@ module ActiveRecord end end - # Updates a single attribute of an object, without calling save. + # Updates a single attribute of an object, without having to call save on that object. # # * Validation is skipped. # * Callbacks are skipped. @@ -209,7 +209,7 @@ module ActiveRecord update_columns(name => value) end - # Updates the attributes from the passed-in hash, without calling save. + # Updates the attributes from the passed-in hash, without having to call save on that object. # # * Validation is skipped. # * Callbacks are skipped. -- cgit v1.2.3 From 26ec070b09ceb798b471fd6999ae1da319120899 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Thu, 11 Oct 2012 00:59:52 +0530 Subject: copy edits [ci skip] --- activerecord/lib/active_record/persistence.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index 0107667fbe..611d3d97c3 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -197,7 +197,7 @@ module ActiveRecord end end - # Updates a single attribute of an object, without having to call save on that object. + # Updates a single attribute of an object, without having to explicitly call save on that object. # # * Validation is skipped. # * Callbacks are skipped. @@ -209,7 +209,7 @@ module ActiveRecord update_columns(name => value) end - # Updates the attributes from the passed-in hash, without having to call save on that object. + # Updates the attributes from the passed-in hash, without having to explicitly call save on that object. # # * Validation is skipped. # * Callbacks are skipped. -- cgit v1.2.3