diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-12-26 14:12:16 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-12-26 14:12:16 -0700 |
commit | a3936bbe21f4bff8247f890cacfd0fc882921003 (patch) | |
tree | 615ff2d3ed709121f8aea1a2cd6eb56870af0ce9 /activerecord/lib/active_record/relation/predicate_builder/range_handler.rb | |
parent | af55197d86676c371a0a50e62c162df4d6006849 (diff) | |
download | rails-a3936bbe21f4bff8247f890cacfd0fc882921003.tar.gz rails-a3936bbe21f4bff8247f890cacfd0fc882921003.tar.bz2 rails-a3936bbe21f4bff8247f890cacfd0fc882921003.zip |
Change `PredicateBuilder` handler methods to instance methods
This will allow us to pass the predicate builder into the constructor of
these handlers. The procs had to be changed to objects, because the
`PredicateBuilder` needs to be marshalable. If we ever decide to make
`register_handler` part of the public API, we should come up with a
better solution which allows procs.
/cc @mrgilman
[Sean Griffin & Melanie Gilman]
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder/range_handler.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder/range_handler.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb new file mode 100644 index 0000000000..47dc46bb4b --- /dev/null +++ b/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb @@ -0,0 +1,9 @@ +module ActiveRecord + class PredicateBuilder + class RangeHandler # :nodoc: + def call(attribute, value) + attribute.between(value) + end + end + end +end |