3 class FilterList < Base
4 attr :filter_key, :filter_item_name
8 @filter_key = @list_manifest.filter_key
9 @filter_item_name = @list_manifest.filter_item_name
12 def where_condition filter_item_id
13 w = self.base_where_condition
14 w += ' and ' unless w.blank?
15 [w + @table_name + '.' + @filter_key + ' = ?', filter_item_id]
20 w.merge!({@filter_item_name => {} }) unless w[@filter_item_name]
24 def items operators, options, offset, page_size
25 filter_item_id = options[:id]
26 @model.where(self.where_condition(filter_item_id)).includes(self.include_hash).order(self.order).offset(offset).limit(page_size)
29 def count operators, options
30 filter_item_id = options[:id]
31 @model.where(self.where_condition(filter_item_id)).includes(self.include_hash).count