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