Sha256: 02460542adc2ecc333854bf593c752e2a4e72e9ec0e67c78850718e871abc1e7
Contents?: true
Size: 513 Bytes
Versions: 2
Compression:
Stored size: 513 Bytes
Contents
module Glue # Search support for Og managed classes. module Searchable def self.included(base) base.extend(ClassMethods) end module ClassMethods # Override this method in your class to customize the # search. This is a nice default method. def search(query) search_props = properties.values.select { |p| p.searchable } condition = search_props.collect { |p| "#{p} LIKE '%#{query}%'" }.join(' OR ') all(:condition => condition) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
og-0.41.0 | lib/glue/searchable.rb |
og-0.40.0 | lib/glue/searchable.rb |