Module: SimpleSearchable::SearchableBy

Defined in:
lib/simple_searchable.rb

Defined Under Namespace

Modules: FilterMethods

Instance Method Summary collapse

Instance Method Details

#searchable_by(*method_names) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/simple_searchable.rb', line 5

def searchable_by(*method_names)
  self.singleton_class.send(:define_method, :search) do |opts|
    return all if opts.nil?

    search_filter_all(method_names, opts)
  end

  self.send(:extend, FilterMethods)
end