Method: ActiveScaffold::Finder::ClassMethods#conditions_for_columns
- Defined in:
- lib/active_scaffold/finder.rb
#conditions_for_columns(tokens, columns, text_search = :full) ⇒ Object
Takes a collection of search terms (the tokens) and creates SQL that searches all specified ActiveScaffold columns. A row will match if each token is found in at least one of the columns.
20 21 22 23 24 25 26 27 |
# File 'lib/active_scaffold/finder.rb', line 20 def conditions_for_columns(tokens, columns, text_search = :full) # if there aren't any columns, then just return a nil condition return unless columns.any? tokens = [tokens] if tokens.is_a? String tokens = type_casted_tokens(tokens, columns, like_pattern(text_search)) create_conditions_for_columns(tokens, columns) end |