aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/writes/update.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/relations/writes/update.rb')
-rw-r--r--lib/arel/relations/writes/update.rb30
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/arel/relations/writes/update.rb b/lib/arel/relations/writes/update.rb
deleted file mode 100644
index 52ca6ecf05..0000000000
--- a/lib/arel/relations/writes/update.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-module Arel
- class Update < Compound
- attributes :relation, :assignments
- deriving :==
-
- def initialize(relation, assignments)
- @relation, @assignments = relation, assignments
- end
-
- def to_sql(formatter = nil)
- [
- "UPDATE #{table_sql} SET",
- map_assignments,
- ("WHERE #{wheres.map(&:to_sql).join('\n\tAND ')}" unless wheres.blank? ),
- ("LIMIT #{taken}" unless taken.blank? )
- ].join("\n")
- end
-
- def call(connection = engine)
- connection.update(to_sql)
- end
-
- def map_assignments
- assignments.collect do |attribute, value|
- attribute.respond_to?(:name) ?
- "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}" : attribute
- end.join(",\n")
- end
- end
-end