From 1f8ecb85d7c1b3efdf45c3cf3461502b608c1a7c Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Sun, 2 Jan 2011 03:35:38 +0700 Subject: Update CHANGELOGs to include 3.0.3 changes --- activerecord/CHANGELOG | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 8ebc87145c..da4bd4f1cb 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -103,7 +103,13 @@ IrreversibleMigration exception will be raised when going down. [Aaron Patterson] -*Rails 3.0.2 (unreleased)* + +*Rails 3.0.3 (November 16, 2010)* + +* Support find by class like this: Post.where(:name => Post) + + +*Rails 3.0.2 (November 15, 2010)* * reorder is deprecated in favor of except(:order).order(...) [Santiago Pastorino] @@ -132,10 +138,12 @@ IrreversibleMigration exception will be raised when going down. [Aaron Patterson] + *Rails 3.0.1 (October 15, 2010)* * Introduce a fix for CVE-2010-3993 + *Rails 3.0.0 (August 29, 2010)* * Changed update_attribute to not run callbacks and update the record directly in the database [Neeraj Singh] -- cgit v1.2.3 From 99424eb0996d41eaccb1b140cc30820fb5779fef Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 2 Jan 2011 00:20:59 +0100 Subject: Revert "Update CHANGELOGs to include 3.0.3 changes" Reason: Sorry, CHANGELOGs can only be edited in master. If you provide a patch I'll apply it myself. Thanks! This reverts commit 1f8ecb85d7c1b3efdf45c3cf3461502b608c1a7c. --- activerecord/CHANGELOG | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'activerecord') diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index da4bd4f1cb..8ebc87145c 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -103,13 +103,7 @@ IrreversibleMigration exception will be raised when going down. [Aaron Patterson] - -*Rails 3.0.3 (November 16, 2010)* - -* Support find by class like this: Post.where(:name => Post) - - -*Rails 3.0.2 (November 15, 2010)* +*Rails 3.0.2 (unreleased)* * reorder is deprecated in favor of except(:order).order(...) [Santiago Pastorino] @@ -138,12 +132,10 @@ IrreversibleMigration exception will be raised when going down. [Aaron Patterson] - *Rails 3.0.1 (October 15, 2010)* * Introduce a fix for CVE-2010-3993 - *Rails 3.0.0 (August 29, 2010)* * Changed update_attribute to not run callbacks and update the record directly in the database [Neeraj Singh] -- cgit v1.2.3 From f612069ae157ba4312672d59dd844a01197cac9e Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Thu, 6 Jan 2011 20:06:52 +1000 Subject: Fix documentation for validates_uniqueness_of to NOT have a :scope argument as the prime example. Show scope examples after prime example. --- activerecord/lib/active_record/validations/uniqueness.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/validations/uniqueness.rb b/activerecord/lib/active_record/validations/uniqueness.rb index 853808eebf..e6a2b40403 100644 --- a/activerecord/lib/active_record/validations/uniqueness.rb +++ b/activerecord/lib/active_record/validations/uniqueness.rb @@ -85,11 +85,16 @@ module ActiveRecord # can be named "davidhh". # # class Person < ActiveRecord::Base - # validates_uniqueness_of :user_name, :scope => :account_id + # validates_uniqueness_of :user_name # end # - # It can also validate whether the value of the specified attributes are unique based on multiple - # scope parameters. For example, making sure that a teacher can only be on the schedule once + # It can also validate whether the value of the specified attributes are unique based on a scope parameter: + # + # class Person < ActiveRecord::Base + # 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 # per semester for a particular class. # # class TeacherSchedule < ActiveRecord::Base -- cgit v1.2.3 From b31ef7ee83f3fe808f7534172ce2bf22ef6c7cc0 Mon Sep 17 00:00:00 2001 From: Jordi Romero Date: Sat, 15 Jan 2011 01:15:05 +0100 Subject: document ActiveRecord's except and only Document methods that allow easily override arel queries --- activerecord/lib/active_record/relation/spawn_methods.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation/spawn_methods.rb b/activerecord/lib/active_record/relation/spawn_methods.rb index 5acf3ec83a..ae777208db 100644 --- a/activerecord/lib/active_record/relation/spawn_methods.rb +++ b/activerecord/lib/active_record/relation/spawn_methods.rb @@ -61,6 +61,13 @@ module ActiveRecord alias :& :merge + # Removes from the query the condition(s) specified in +skips+. + # + # Example: + # + # Post.order('id asc').except(:order) # discards the order condition + # Post.where('id > 10').order('id asc').except(:where) # discards the where condition but keeps the order + # def except(*skips) result = self.class.new(@klass, table) @@ -75,6 +82,13 @@ module ActiveRecord result end + # Removes any condition from the query other than the one(s) specified in +onlies+. + # + # Example: + # + # Post.order('id asc').only(:where) # discards the order condition + # Post.order('id asc').only(:where, :order) # uses the specified order + # def only(*onlies) result = self.class.new(@klass, table) -- cgit v1.2.3 From 4b7dad2df3fc252acdb3fd8362370daac16540e4 Mon Sep 17 00:00:00 2001 From: Jaime Iniesta Date: Tue, 18 Jan 2011 00:35:07 +0100 Subject: ActiveRecord#save(false) is now deprecated, now it is save(:validate => false) --- activerecord/lib/active_record/validations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index f367315b22..26c1a9db93 100644 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -37,7 +37,7 @@ module ActiveRecord end end - # The validation process on save can be skipped by passing false. The regular Base#save method is + # The validation process on save can be skipped by passing :validate => false. The regular Base#save method is # replaced with this when the validations module is mixed in, which it is by default. def save(options={}) perform_validations(options) ? super : false -- cgit v1.2.3