public
Rubygem
Description: Most awesome pagination solution for Ruby
Homepage: http://github.com/mislav/will_paginate/wikis
Clone URL: git://github.com/mislav/will_paginate.git
Search Repo:
take less risky path when monkeypatching named_scope; fix that it no 
longer requires ActiveRecord::VERSION
mislav (author)
Mon Apr 07 15:09:35 -0700 2008
commit  674205dc34db211f0d0722bd19b03fac5f691f74
tree    fba58e2d5df423284d637c0d5596c15d8eb4d8b2
parent  5ec1acac44a49e783cf69e41ae5404204131f173
...
11
12
13
14
15
16
17
18
19
20
21
22
 
 
 
 
23
24
25
26
27
28
29
30
 
31
32
33
...
47
48
49
50
 
...
11
12
13
 
 
 
 
 
 
 
 
 
14
15
16
17
18
 
 
 
 
 
 
 
19
20
21
22
...
36
37
38
 
39
0
@@ -11,23 +11,12 @@ end
0
     ActiveRecord::Associations::HasManyThroughAssociation ].each do |klass|
0
   klass.class_eval do
0
     protected
0
- def method_missing_without_paginate(method, *args)
0
- if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
0
- if block_given?
0
- super { |*block_args| yield(*block_args) }
0
- else
0
- super
0
- end
0
- elsif @reflection.klass.scopes.include?(method)
0
- @reflection.klass.scopes[method].call(self, *args)
0
+ alias :method_missing_without_scopes :method_missing_without_paginate
0
+ def method_missing_without_paginate(method, *args, &block)
0
+ if @reflection.klass.scopes.include?(method)
0
+ @reflection.klass.scopes[method].call(self, *args, &block)
0
       else
0
- with_scope construct_scope do
0
- if block_given?
0
- @reflection.klass.send(method, *args) { |*block_args| yield(*block_args) }
0
- else
0
- @reflection.klass.send(method, *args)
0
- end
0
- end
0
+ method_missing_without_scopes(method, *args, &block)
0
       end
0
     end
0
   end
0
@@ -47,4 +36,4 @@ ActiveRecord::Associations::HasAndBelongsToManyAssociation.class_eval do
0
       end
0
     end
0
   end
0
-end if ActiveRecord::VERSION::MAJOR < 2
0
+end if ActiveRecord::Base.respond_to? :find_first

Comments

    No one has commented yet.