OSDN Git Service

merge
[pettanr/pettanr.git] / lib / manifest / local / view / list_group / list / through_filter.rb
1 module Manifest
2   module View
3     module ListGroupModule
4       class ThroughFilterList < FilterList
5         attr :through
6         
7         def init
8           super
9           @through = @list_manifest.through
10           @filter_table_name = ::Manifest.manifest.models[@filter_item_name].classify.table_name
11         end
12         
13         def include_hash
14           {@through => {@filter_item_name => {}} }
15         end
16         
17         def where_condition filter_item_id
18           w = self.base_where_condition
19           w += ' and ' unless w.blank?
20           [w + @filter_table_name + '.id' + ' = ?', filter_item_id] 
21         end
22         
23       end
24       
25     end
26   end
27 end