diff options
author | Keenan Brock <keenan@thebrocks.net> | 2016-10-04 18:31:01 -0400 |
---|---|---|
committer | Keenan Brock <keenan@thebrocks.net> | 2017-12-05 09:36:08 -0500 |
commit | ff53df96875de84ee02895772b59448f35a5a0c2 (patch) | |
tree | 9a6e6c8a395702a7aa1e992c9ca9ccfc602562dd | |
parent | 2d78e3a160068d7a024e30b2178084d16cea9807 (diff) | |
download | rails-ff53df96875de84ee02895772b59448f35a5a0c2.tar.gz rails-ff53df96875de84ee02895772b59448f35a5a0c2.tar.bz2 rails-ff53df96875de84ee02895772b59448f35a5a0c2.zip |
Delete is not a NodeExpression, change parent
This requires a little cut and paste from the Binary node, but it is
used in different parts of sql
-rw-r--r-- | lib/arel/nodes/delete_statement.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/arel/nodes/delete_statement.rb b/lib/arel/nodes/delete_statement.rb index 593ce9bddf..063a5341e5 100644 --- a/lib/arel/nodes/delete_statement.rb +++ b/lib/arel/nodes/delete_statement.rb @@ -1,7 +1,8 @@ # frozen_string_literal: true module Arel module Nodes - class DeleteStatement < Arel::Nodes::Binary + class DeleteStatement < Arel::Nodes::Node + attr_accessor :left, :right attr_accessor :limit alias :relation :left @@ -10,13 +11,27 @@ module Arel alias :wheres= :right= def initialize relation = nil, wheres = [] - super + super() + @left = relation + @right = wheres end def initialize_copy other super - @right = @right.clone + @left = @left.clone if @left + @right = @right.clone if @right + end + + def hash + [self.class, @left, @right].hash + end + + def eql? other + self.class == other.class && + self.left == other.left && + self.right == other.right end + alias :== :eql? end end end |