aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/nodes/bind_param.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-07-24 08:04:56 -0400
committerSean Griffin <sean@seantheprogrammer.com>2017-07-24 08:04:56 -0400
commit7a29220c689feb0581e21d5324b85fc2f201ac5e (patch)
tree42d4cc0055143b9e55cf2be1eb524709cc8bbc15 /lib/arel/nodes/bind_param.rb
parentecec50da1d709f9b442c88c2f53a8065e2ed6548 (diff)
downloadrails-7a29220c689feb0581e21d5324b85fc2f201ac5e.tar.gz
rails-7a29220c689feb0581e21d5324b85fc2f201ac5e.tar.bz2
rails-7a29220c689feb0581e21d5324b85fc2f201ac5e.zip
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
Diffstat (limited to 'lib/arel/nodes/bind_param.rb')
-rw-r--r--lib/arel/nodes/bind_param.rb6
1 files changed, 5 insertions, 1 deletions
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