Module: Searchify::SearchifyHelper

Defined in:
app/helpers/searchify/searchify_helper.rb

Instance Method Summary collapse

Instance Method Details

#searchify(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/helpers/searchify/searchify_helper.rb', line 3

def searchify(*args)
  options = args.extract_options!

  # searchify options
  collection  = options.delete(:collection) || args.shift || extract_collection
  search_url  = options.delete(:search_url) || extract_search_url(collection, options.delete(:scopes), options.delete(:search_strategy))
  select_url  = options.delete(:select_url) || extract_select_url(options.delete(:action))

  # tag options
  options[:class] = [:searchify].push(options[:class]).flatten.compact
  options[:data]  = {:'select-url' => select_url, :'search-url' => search_url}.merge(options[:data] || {})

  text_field_tag(:searchify, nil, options)
end