kaminari 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of kaminari might be problematic. Click here for more details.

data/TODO.txt CHANGED
@@ -1,7 +1,5 @@
1
1
  * partialize the outer div
2
2
 
3
- * suppress logging when rendering each partial
4
-
5
3
  * add generator option to copy particular template
6
4
 
7
5
  * add Haml generator
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{kaminari}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Akira Matsuda"]
@@ -63,8 +63,10 @@ module Kaminari
63
63
  end
64
64
 
65
65
  def to_s
66
- @template.content_tag :div, :class => 'pagination' do
67
- tagify.join("\n").html_safe
66
+ suppress_logging_render_partial do
67
+ @template.content_tag :div, :class => 'pagination' do
68
+ tagify.join("\n").html_safe
69
+ end
68
70
  end
69
71
  end
70
72
 
@@ -96,6 +98,25 @@ module Kaminari
96
98
  def method_missing(meth, *args, &blk)
97
99
  @template.send meth, *args, &blk
98
100
  end
101
+
102
+ def suppress_logging_render_partial(&blk)
103
+ if subscriber = ActionView::LogSubscriber.log_subscribers.detect {|ls| ls.is_a? ActionView::LogSubscriber}
104
+ class << subscriber
105
+ alias_method :render_partial_with_logging, :render_partial
106
+ # do nothing
107
+ def render_partial(event)
108
+ end
109
+ end
110
+ ret = blk.call
111
+ class << subscriber
112
+ alias_method :render_partial, :render_partial_with_logging
113
+ undef :render_partial_with_logging
114
+ end
115
+ ret
116
+ else
117
+ blk.call
118
+ end
119
+ end
99
120
  end
100
121
 
101
122
  def paginate(scope, options = {}, &block)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akira Matsuda