OSDN Git Service

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