class Object

mixin extensions to respective classes

Public Instance Methods

build_relation(filter) click to toggle source
# File lib/generators/riveter/query/templates/query.rb, line 10
def build_relation(filter)
  # start with a relation
  relation = <%= class_name %>.all

  #
  # TODO: apply conditions etc to the query using the filter
  #
  # E.g.
  #
  # :.name filter
  #
  # relation = relation.where?(filter.name_like.present?, 'name LIKE ?', filter.name_like)
  #
  # :. page filter
  # relation.page(filter.page)
  #

  relation
end