Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [#67 state:resolved]
This commit is contained in:
parent
5cef8bcc54
commit
c353794dff
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Fixed that pessimistic locking you reference the quoted table name (Josh Susser) [#67]
|
||||
|
||||
* Fixed that change_column should be able to use :null => true on a field that formerly had false [Nate Wiger] [#26]
|
||||
|
||||
* Added that the MySQL adapter should map integer to either smallint, int, or bigint depending on the :limit just like PostgreSQL [DHH]
|
||||
|
|
|
@ -78,7 +78,7 @@ module ActiveRecord
|
|||
|
||||
begin
|
||||
affected_rows = connection.update(<<-end_sql, "#{self.class.name} Update with optimistic locking")
|
||||
UPDATE #{self.class.table_name}
|
||||
UPDATE #{self.class.quoted_table_name}
|
||||
SET #{quoted_comma_pair_list(connection, attributes_with_quotes(false, false, attribute_names))}
|
||||
WHERE #{self.class.primary_key} = #{quote_value(id)}
|
||||
AND #{self.class.quoted_locking_column} = #{quote_value(previous_value)}
|
||||
|
|
|
@ -2,6 +2,7 @@ require "cases/helper"
|
|||
require 'models/person'
|
||||
require 'models/reader'
|
||||
require 'models/legacy_thing'
|
||||
require 'models/reference'
|
||||
|
||||
class LockWithoutDefault < ActiveRecord::Base; end
|
||||
|
||||
|
@ -15,7 +16,7 @@ class ReadonlyFirstNamePerson < Person
|
|||
end
|
||||
|
||||
class OptimisticLockingTest < ActiveRecord::TestCase
|
||||
fixtures :people, :legacy_things
|
||||
fixtures :people, :legacy_things, :references
|
||||
|
||||
# need to disable transactional fixtures, because otherwise the sqlite3
|
||||
# adapter (at least) chokes when we try and change the schema in the middle
|
||||
|
@ -138,6 +139,12 @@ class OptimisticLockingTest < ActiveRecord::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_quote_table_name
|
||||
ref = references(:michael_magician)
|
||||
ref.favourite = !ref.favourite
|
||||
assert ref.save
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -206,6 +206,7 @@ ActiveRecord::Schema.define do
|
|||
t.integer :person_id
|
||||
t.integer :job_id
|
||||
t.boolean :favourite
|
||||
t.integer :lock_version, :default => 0
|
||||
end
|
||||
|
||||
create_table :minimalistics, :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue