aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/arel/algebra/relations/operations/lock.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/arel/algebra/relations/operations/lock.rb b/lib/arel/algebra/relations/operations/lock.rb
index 4520fd668b..003bd29c8a 100644
--- a/lib/arel/algebra/relations/operations/lock.rb
+++ b/lib/arel/algebra/relations/operations/lock.rb
@@ -1,12 +1,16 @@
module Arel
class Lock < Compound
- attributes :relation, :locked
- deriving :==
+ attr_reader :locked
def initialize(relation, locked)
- @relation = relation
+ super(relation)
@locked = locked.blank? ? " FOR UPDATE" : locked
end
+
+ def == other
+ super || Lock === other &&
+ relation == other.relation &&
+ locked == other.locked
+ end
end
end
-