OSDN Git Service

change page status
[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           ::Locmare::Filer.new(
27             self.has_many_model.item_name, list.items, 
28             list.page_status, self.profiler.operators
29           )
30         end
31         
32         def profiler
33           @association.profiler
34         end
35         
36       end
37     end
38   end
39 end