blob: 16fe3d5f46927a3b09764873fa389fb5bb9de4c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
module ActiveRelation
class Insertion < Compound
attr_reader :record
def initialize(relation, record)
@relation, @record = relation, record
end
def to_sql(strategy = nil)
[
"INSERT",
"INTO #{table_sql}",
"(#{record.keys.collect(&:to_sql).join(', ')})",
"VALUES #{record.values.to_sql}"
].join("\n")
end
def ==(other)
self.class == other.class and
relation == other.relation and
record == other.record
end
end
end
|