| Module | Searchlogic::ActiveRecord::Scope |
| In: |
lib/searchlogic/active_record/scope.rb
|
The internals to ActiveRecord like to do scopes.include?(scope_name). And this is how they check for the existence of scopes, which is terrible. The problem is that searchlogic scopes are dynamically created. So the only solution is to override the include? method for the scopes hash, try to create the named scope, and then check it again. This shouldn‘t effect performance because once its created it never gets called again. I also cache failed names so we don‘t try to create them again.