lib/scoped_search/definition.rb in scoped_search-3.2.0 vs lib/scoped_search/definition.rb in scoped_search-3.2.1

- old
+ new

@@ -248,10 +248,10 @@ # Registers the search_for named scope within the class that is used for searching. def register_named_scope! # :nodoc definition = self @klass.scope(:search_for, proc { |query, options| - search_scope = ActiveRecord::VERSION::MAJOR == 3 ? @klass.scoped : @klass + search_scope = ActiveRecord::VERSION::MAJOR == 3 ? @klass.scoped : (ActiveRecord::VERSION::MINOR < 1 ? @klass.where(nil) : @klass.all) find_options = ScopedSearch::QueryBuilder.build_query(definition, query || '', options || {}) search_scope = search_scope.where(find_options[:conditions]) if find_options[:conditions] search_scope = search_scope.includes(find_options[:include]) if find_options[:include] search_scope = search_scope.joins(find_options[:joins]) if find_options[:joins]