OSDN Git Service

rename model name
[pettanr/pettanr.git] / lib / locmare / profiler / association / has_many.rb
1 module Locmare
2   module ProfilerModule
3     module AssociationModule
4       class HasMany
5         attr :association, :has_many_manifest
6         def initialize association, has_many_manifest
7           @association = association
8           @has_many_manifest = has_many_manifest
9         end
10         
11         def item
12           self.profiler.item
13         end
14         
15         def has_many_model
16           @has_many_manifest.model
17         end
18         
19         def filer
20           list = ::Locmare::ListGroup.list(
21             @has_many_manifest.controller_name, 
22             @has_many_manifest.action_name, 
23             self.profiler.operators, 
24             {:id => self.item.id, :page => 1, :page_size => 3}
25           )
26           list_result = list.open(self.profiler.operators)
27           items = list_result.items
28           ::Locmare::Filer.new self.has_many_model.item_name, items, list_result, :more, self.profiler.operators
29         end
30         
31         def profiler
32           @association.profiler
33         end
34         
35       end
36     end
37   end
38 end