diff options
Diffstat (limited to 'activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb b/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb new file mode 100644 index 0000000000..063150958a --- /dev/null +++ b/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb @@ -0,0 +1,13 @@ +module ActiveRecord + class PredicateBuilder + class RelationHandler # :nodoc: + def call(attribute, value) + if value.select_values.empty? + value = value.select(value.klass.arel_table[value.klass.primary_key]) + end + + attribute.in(value.arel) + end + end + end +end |