Permalink
Browse files

Fixed dependency issue

  • Loading branch information...
1 parent effb60d commit fa46e4c9397f7b4c0a06f55f34f903d02e2a8bf0 @towski towski committed Jul 30, 2008
Showing with 3 additions and 16 deletions.
  1. +3 −16 lib/can_search/search_scopes.rb
@@ -103,23 +103,10 @@ def ==(other)
end
end
- class LikeQueryScope < BaseScope
- def initialize(model, name, options = {})
- super
- @named_scope = options[:named_scope] || "like_#{name}".to_sym
- @format = options[:format] || "%%%s%%"
- @model.named_scope @named_scope, lambda { |q| {:conditions => ["#{@name} LIKE ?", @format % q]} }
- end
-
- def scope_for(finder, options = {})
- query = options.delete(@name)
- query.blank? ? finder : finder.send(@named_scope, query)
- end
- end
SearchScopes.scope_types.update \
- :reference => ReferenceScope,
- :like => LikeQueryScope
+ :reference => ReferenceScope
end
-send respond_to?(:require_dependency) ? :require_dependency : :require, 'can_search/date_range_scope'
+send respond_to?(:require_dependency) ? :require_dependency : :require, 'can_search/date_range_scope'
+send respond_to?(:require_dependency) ? :require_dependency : :require, 'can_search/like_query_scope'

0 comments on commit fa46e4c

Please sign in to comment.