From 31fce0192ee83ee13e2b17fdeefa712227019e49 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 31 Jan 2012 12:09:08 -0200 Subject: Improve readonly examples and optimistic locking docs * Relation#order can receive order attributes as different arguments, add example; * Readonly does not handle deletion of records, only modification; * locking_version column does not need to default to 0, Rails handles nil values; * Change references from "set_locking_column" to "self.locking_column". --- activerecord/lib/active_record/locking/optimistic.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index e643c0d437..4d73cdd37a 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -40,11 +40,13 @@ module ActiveRecord # This locking mechanism will function inside a single Ruby process. To make it work across all # web requests, the recommended approach is to add +lock_version+ as a hidden field to your form. # - # You must ensure that your database schema defaults the +lock_version+ column to 0. - # # This behavior can be turned off by setting ActiveRecord::Base.lock_optimistically = false. - # To override the name of the +lock_version+ column, invoke the set_locking_column method. - # This method uses the same syntax as set_table_name + # To override the name of the +lock_version+ column, set the locking_column class attribute: + # + # class Person < ActiveRecord::Base + # self.locking_column = :lock_person + # end + # module Optimistic extend ActiveSupport::Concern -- cgit v1.2.3