From 7a29220c689feb0581e21d5324b85fc2f201ac5e Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 24 Jul 2017 08:04:56 -0400 Subject: Adjust `BindParam` as needed for AR We need `value` to have a writer for `StatementCache` to work when prepared statements are disabled. This is something I'd like to revert eventually, either by disabling that form of caching in that case or re-introducing something like the old `Bind` collector. The addition of `nil?` is to make `IS NULL` be inserted correctly, similar to what we already do with quoted and casted nodes --- lib/arel/nodes/bind_param.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/arel/nodes') diff --git a/lib/arel/nodes/bind_param.rb b/lib/arel/nodes/bind_param.rb index d55f4c1c8e..225fcc4798 100644 --- a/lib/arel/nodes/bind_param.rb +++ b/lib/arel/nodes/bind_param.rb @@ -2,7 +2,7 @@ module Arel module Nodes class BindParam < Node - attr_reader :value + attr_accessor :value def initialize(value) @value = value @@ -13,6 +13,10 @@ module Arel other.is_a?(BindParam) && value == other.value end + + def nil? + value.nil? + end end end end -- cgit v1.2.3