Module: TagQueryBuilder

Included in:
Ems::TagsController
Defined in:
lib/query_builder/tag_query_builder.rb

Instance Method Summary collapse

Instance Method Details

#add_filter_for_like(q, like) ⇒ Object

Fucntion to add a like to the name



11
12
13
# File 'lib/query_builder/tag_query_builder.rb', line 11

def add_filter_for_like(q, like)
  q.where '(title LIKE ?)', "%#{like}%"
end

#build_query_from_filters(q, filters) ⇒ Object



3
4
5
6
7
8
# File 'lib/query_builder/tag_query_builder.rb', line 3

def build_query_from_filters(q, filters)
  filters.each do |filter, value|
    q = method("add_filter_for_#{filter}".to_sym).call(q, value)
  end
  return q
end