aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-11-02 18:12:18 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-11-02 18:12:18 +0000
commit88d9b32496140c9a00b8c1e1e55c48bd6f653756 (patch)
tree093621c932b063e1bf8a5d0e99806f003b3bd73c /activerecord/lib/active_record
parent7ca2b657f01b09014cd1fb0494fb13ab63dafe5c (diff)
downloadrails-88d9b32496140c9a00b8c1e1e55c48bd6f653756.tar.gz
rails-88d9b32496140c9a00b8c1e1e55c48bd6f653756.tar.bz2
rails-88d9b32496140c9a00b8c1e1e55c48bd6f653756.zip
Deprecation: object transactions warning.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5405 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/transactions.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/transactions.rb b/activerecord/lib/active_record/transactions.rb
index 84da1e91d6..6a776966bb 100644
--- a/activerecord/lib/active_record/transactions.rb
+++ b/activerecord/lib/active_record/transactions.rb
@@ -55,7 +55,7 @@ module ActiveRecord
# will happen under the protected cover of a transaction. So you can use validations to check for values that the transaction
# depend on or you can raise exceptions in the callbacks to rollback.
#
- # == Object-level transactions
+ # == Object-level transactions (deprecated)
#
# You can enable object-level transactions for Active Record objects, though. You do this by naming each of the Active Records
# that you want to enable object-level transactions for, like this:
@@ -65,8 +65,14 @@ module ActiveRecord
# mary.deposit(100)
# end
#
- # If the transaction fails, David and Mary will be returned to their pre-transactional state. No money will have changed hands in
- # neither object nor database.
+ # If the transaction fails, David and Mary will be returned to their
+ # pre-transactional state. No money will have changed hands in neither
+ # object nor database.
+ #
+ # However, useful state such as validation errors are also rolled back,
+ # limiting the usefulness of this feature. As such it is deprecated in
+ # Rails 1.2 and will be removed in the next release. Install the
+ # object_transactions plugin if you wish to continue using it.
#
# == Exception handling
#
@@ -80,8 +86,11 @@ module ActiveRecord
increment_open_transactions
begin
- objects.each { |o| o.extend(Transaction::Simple) }
- objects.each { |o| o.start_transaction }
+ unless objects.empty?
+ ActiveSupport::Deprecation.warn "Object transactions are deprecated and will be removed from Rails 2.0. See http://www.rubyonrails.org/deprecation for details.", caller
+ objects.each { |o| o.extend(Transaction::Simple) }
+ objects.each { |o| o.start_transaction }
+ end
result = connection.transaction(Thread.current['start_db_transaction'], &block)