diff options
author | Bryan Helmkamp <bryan@brynary.com> | 2009-05-11 22:23:47 -0400 |
---|---|---|
committer | Bryan Helmkamp <bryan@brynary.com> | 2009-05-11 22:23:47 -0400 |
commit | a2875bec9a31702a385d2f34e66843ddbe4e9db2 (patch) | |
tree | 18e221e8a08f041efd7cb751d5114cf6430272f6 /activerecord/lib/active_record/locking | |
parent | 00a9d4b91cccdd88146cbe716eca844dcdfa08e7 (diff) | |
download | rails-a2875bec9a31702a385d2f34e66843ddbe4e9db2.tar.gz rails-a2875bec9a31702a385d2f34e66843ddbe4e9db2.tar.bz2 rails-a2875bec9a31702a385d2f34e66843ddbe4e9db2.zip |
Use DependencyModule for included hooks in ActiveRecord
Diffstat (limited to 'activerecord/lib/active_record/locking')
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 7fa7e267d8..cf4f8864c6 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -42,17 +42,17 @@ module ActiveRecord # To override the name of the lock_version column, invoke the <tt>set_locking_column</tt> method. # This method uses the same syntax as <tt>set_table_name</tt> module Optimistic - def self.included(base) #:nodoc: - base.extend ClassMethods + extend ActiveSupport::DependencyModule - base.cattr_accessor :lock_optimistically, :instance_writer => false - base.lock_optimistically = true + included do + cattr_accessor :lock_optimistically, :instance_writer => false + self.lock_optimistically = true - base.alias_method_chain :update, :lock - base.alias_method_chain :destroy, :lock - base.alias_method_chain :attributes_from_column_definition, :lock + alias_method_chain :update, :lock + alias_method_chain :destroy, :lock + alias_method_chain :attributes_from_column_definition, :lock - class << base + class << self alias_method :locking_column=, :set_locking_column end end |