lib/sakuramochi/predicate_builder.rb in sakuramochi-0.5.7 vs lib/sakuramochi/predicate_builder.rb in sakuramochi-0.5.8

- old
+ new

@@ -5,12 +5,12 @@ module PredicateBuilder extend ActiveSupport::Concern included do unless respond_to? :build - model_class = defined?(ActiveRecord::Model) ? ActiveRecord::Model : ActiveRecord::Base - def self.build(attribute, value) + model_class = defined?(ActiveRecord::Model) ? ActiveRecord::Model : ActiveRecord::Base + case value when ActiveRecord::Relation value = value.select(value.klass.arel_table[value.klass.primary_key]) if value.select_values.empty? attribute.in(value.arel.ast) when Array, ActiveRecord::Associations::CollectionProxy