aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb
Commit message (Collapse)AuthorAgeFilesLines
* Ensure `apply_join_dependency` for subqueries in `from` and `where`Ryuta Kamizono2017-11-101-0/+4
| | | | Fixes #21577.
* Use frozen-string-literal in ActiveRecordKir Shatrov2017-07-191-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Extract a Relation#arel_attributeMatthew Draper2016-02-041-1/+1
|
* Defer Arel attribute lookup to the model classMatthew Draper2016-02-041-1/+1
| | | | | This still isn't as separated as I'd like, but it at least moves most of the burden of alias mapping in one place.
* Pass the `SelectManager`, rather than the AST when querying w/ RelationSean Griffin2014-11-021-1/+1
| | | | | | Arel specifically handles `SelectManager`, with the same logic we're currently performing. The AST is `Enumerable`, which Arel looks for separately now.
* Add ability to specify how a class is converted to Arel predicatesgrif2013-07-281-0/+13
This adds the ability for rails apps or gems to have granular control over how a domain object is converted to sql. One simple use case would be to add support for Regexp. Another simple case would be something like the following: class DateRange < Struct.new(:start, :end) def include?(date) (start..end).cover?(date) end end class DateRangePredicate def call(attribute, range) attribute.in(range.start..range.end) end end ActiveRecord::PredicateBuilder.register_handler(DateRange, DateRangePredicate.new) More complex cases might include taking a currency object and converting it from EUR to USD before performing the query. By moving the existing handlers to this format, we were also able to nicely refactor a rather nasty method in PredicateBuilder.