module ActiveScaffold::Finder::ClassMethods::Mongoid
Public Instance Methods
Source
# File lib/active_scaffold/finder.rb, line 71 def create_conditions_for_columns(tokens, columns) conditions = tokens.map do |columns_token| token_conditions = columns.map do |column| value = columns_token[column.name] value = /#{value}/ if column.text? column.search_sql.map do |search_sql| # call .to_s so String is returned from CowProxy::String in threadsafe mode # in other case, or method from Mongoid would fail {search_sql.to_s => value} end end.flatten active_scaffold_config.model.or(token_conditions).selector end [active_scaffold_config.model.and(conditions).selector] end
Source
# File lib/active_scaffold/finder.rb, line 87 def like_pattern(text_search) case text_search when :full then '?' when :start then '^?' when :end then '?$' else '^?$' end end