diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-05-25 15:58:16 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-06-15 19:15:36 +0100 |
commit | e030f26ad3de98205edec9d8b59ecca9508cb57d (patch) | |
tree | c57029efc255a81b6487803e02d2e38e0f0082b3 /activerecord/lib/active_record/locking | |
parent | 61826bcca3481a85649be714a91a45ca909f2726 (diff) | |
download | rails-e030f26ad3de98205edec9d8b59ecca9508cb57d.tar.gz rails-e030f26ad3de98205edec9d8b59ecca9508cb57d.tar.bz2 rails-e030f26ad3de98205edec9d8b59ecca9508cb57d.zip |
Simplify AR configuration code.
Get rid of ActiveModel::Configuration, make better use of
ActiveSupport::Concern + class_attribute, etc.
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 05e052b953..4ce42feb74 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -1,4 +1,9 @@ module ActiveRecord + ActiveSupport.on_load(:active_record_config) do + mattr_accessor :lock_optimistically, instance_accessor: false + self.lock_optimistically = true + end + module Locking # == What is Optimistic Locking # @@ -51,8 +56,7 @@ module ActiveRecord extend ActiveSupport::Concern included do - config_attribute :lock_optimistically, :global => true - self.lock_optimistically = true + config_attribute :lock_optimistically end def locking_enabled? #:nodoc: |