diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-04-24 17:10:52 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-04-24 17:10:52 -0300 |
commit | 1b1fc880bf7129a422901417bd6b9fede292aa7e (patch) | |
tree | 62fa68b6edeed1a61ab13887fa6fafe804abfc8d /lib/arel/relations/writes/update.rb | |
parent | a454d45403cd0b8a24b05b7ff37021e307905825 (diff) | |
download | rails-1b1fc880bf7129a422901417bd6b9fede292aa7e.tar.gz rails-1b1fc880bf7129a422901417bd6b9fede292aa7e.tar.bz2 rails-1b1fc880bf7129a422901417bd6b9fede292aa7e.zip |
Removed table quotings to be SQLite3 compliant. Delete and update will returrn the size of modified records to prevent addional queries to be done.
Diffstat (limited to 'lib/arel/relations/writes/update.rb')
-rw-r--r-- | lib/arel/relations/writes/update.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/arel/relations/writes/update.rb b/lib/arel/relations/writes/update.rb index 720b9d697d..3b43152ad6 100644 --- a/lib/arel/relations/writes/update.rb +++ b/lib/arel/relations/writes/update.rb @@ -2,7 +2,7 @@ module Arel class Update < Compound attributes :relation, :assignments deriving :== - + def initialize(relation, assignments) @relation, @assignments = relation, assignments.bind(relation) end @@ -11,15 +11,15 @@ module Arel [ "UPDATE #{table_sql} SET", assignments.collect do |attribute, value| - "#{value.format(attribute)} = #{attribute.format(value)}" + "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}" end.join(",\n"), - ("WHERE #{wheres.collect(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ), + ("WHERE #{wheres.map(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ), ("LIMIT #{taken}" unless taken.blank? ) ].join("\n") end - - def call(connection = engine.connection) + + def call(connection = engine) connection.update(to_sql) end end -end
\ No newline at end of file +end |