diff --git a/lib/validates_overlap/overlap_validator.rb b/lib/validates_overlap/overlap_validator.rb index f762821..5ac19f0 100644 --- a/lib/validates_overlap/overlap_validator.rb +++ b/lib/validates_overlap/overlap_validator.rb @@ -40,7 +40,8 @@ def validate(record) protected def initialize_query(record, options = {}) - self.scoped_model = options[:scoped_model].present? ? options[:scoped_model].constantize : record.class + scoped_model = options[:scoped_model].present? ? options[:scoped_model].constantize : record.class + self.scoped_model = scoped_model.default_scoped generate_overlap_sql_values(record) generate_overlap_sql_conditions(record) add_attributes(record, options[:scope]) if options && options[:scope].present?