Changeset 8156
- Timestamp:
- 11/16/07 20:31:24 (1 year ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/locking/optimistic.rb (modified) (1 diff)
- trunk/activerecord/test/locking_test.rb (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r8138 r8156 1 1 *SVN* 2 3 * attr_readonly behaves well with optimistic locking. #10188 [Nick Bugajski] 2 4 3 5 * Base#to_xml supports the nil="true" attribute like Hash#to_xml. #8268 [Catfish] trunk/activerecord/lib/active_record/locking/optimistic.rb
r6843 r8156 77 77 affected_rows = connection.update(<<-end_sql, "#{self.class.name} Update with optimistic locking") 78 78 UPDATE #{self.class.table_name} 79 SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false ))}79 SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false, false))} 80 80 WHERE #{self.class.primary_key} = #{quote_value(id)} 81 81 AND #{self.class.quoted_locking_column} = #{quote_value(previous_value)} trunk/activerecord/test/locking_test.rb
r7472 r8156 9 9 set_table_name :lock_without_defaults_cust 10 10 set_locking_column :custom_lock_version 11 end 12 13 class ReadonlyFirstNamePerson < Person 14 attr_readonly :first_name 11 15 end 12 16 … … 93 97 t1 = LockWithCustomColumnWithoutDefault.new 94 98 assert_equal 0, t1.custom_lock_version 99 end 100 101 def test_readonly_attributes 102 assert_equal [ :first_name ], ReadonlyFirstNamePerson.readonly_attributes 103 104 p = ReadonlyFirstNamePerson.create(:first_name => "unchangeable name") 105 p.reload 106 assert_equal "unchangeable name", p.first_name 107 108 p.update_attributes(:first_name => "changed name") 109 p.reload 110 assert_equal "unchangeable name", p.first_name 95 111 end 96 112