diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-24 08:04:56 -0400 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2017-07-24 08:04:56 -0400 |
commit | 7a29220c689feb0581e21d5324b85fc2f201ac5e (patch) | |
tree | 42d4cc0055143b9e55cf2be1eb524709cc8bbc15 /lib/arel | |
parent | ecec50da1d709f9b442c88c2f53a8065e2ed6548 (diff) | |
download | rails-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')
-rw-r--r-- | lib/arel/nodes/bind_param.rb | 6 |
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 |