elastic_searchable 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,8 +49,8 @@ module ElasticSearchable
49
49
  # Model.per_page
50
50
  # Model.max_per_page
51
51
  def per_page_for_search(options = {})
52
- per_page = options.delete(:per_page) || (self.respond_to?(:per_page) ? self.per_page : nil) || ElasticSearchable::Queries::PER_PAGE_DEFAULT
53
- per_page = [per_page.to_i, self.max_per_page].min if self.respond_to?(:max_per_page)
52
+ per_page = (options.delete(:per_page) || (self.respond_to?(:per_page) ? self.per_page : nil) || ElasticSearchable::Queries::PER_PAGE_DEFAULT).to_i
53
+ per_page = [per_page, self.max_per_page].min if self.respond_to?(:max_per_page)
54
54
  per_page
55
55
  end
56
56
  end
@@ -1,4 +1,4 @@
1
1
  module ElasticSearchable
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
4
4
 
@@ -217,6 +217,15 @@ class TestElasticSearchable < Test::Unit::TestCase
217
217
  end
218
218
  end
219
219
 
220
+ context 'when per_page is a string' do
221
+ setup do
222
+ @results = Post.search 'foo', :per_page => 1.to_s, :sort => 'id'
223
+ end
224
+ should 'find first object' do
225
+ assert_contains @results, @first_post
226
+ end
227
+ end
228
+
220
229
  context 'searching for second page using will_paginate params' do
221
230
  setup do
222
231
  @results = Post.search 'foo', :page => 2, :per_page => 1, :sort => 'id'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_searchable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
@@ -15,13 +15,12 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-20 00:00:00 -07:00
19
- default_executable:
18
+ date: 2011-10-21 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: activerecord
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ">="
@@ -32,12 +31,12 @@ dependencies:
32
31
  - 0
33
32
  - 5
34
33
  version: 3.0.5
34
+ requirement: *id001
35
35
  type: :runtime
36
- version_requirements: *id001
37
36
  - !ruby/object:Gem::Dependency
38
37
  name: httparty
39
38
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
42
  - - ~>
@@ -48,12 +47,12 @@ dependencies:
48
47
  - 6
49
48
  - 0
50
49
  version: 0.6.0
50
+ requirement: *id002
51
51
  type: :runtime
52
- version_requirements: *id002
53
52
  - !ruby/object:Gem::Dependency
54
53
  name: backgrounded
55
54
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
57
56
  none: false
58
57
  requirements:
59
58
  - - ~>
@@ -64,12 +63,12 @@ dependencies:
64
63
  - 7
65
64
  - 0
66
65
  version: 0.7.0
66
+ requirement: *id003
67
67
  type: :runtime
68
- version_requirements: *id003
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: multi_json
71
70
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
71
+ version_requirements: &id004 !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
74
  - - ~>
@@ -80,12 +79,12 @@ dependencies:
80
79
  - 0
81
80
  - 0
82
81
  version: 1.0.0
82
+ requirement: *id004
83
83
  type: :runtime
84
- version_requirements: *id004
85
84
  - !ruby/object:Gem::Dependency
86
85
  name: rake
87
86
  prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
87
+ version_requirements: &id005 !ruby/object:Gem::Requirement
89
88
  none: false
90
89
  requirements:
91
90
  - - "="
@@ -96,12 +95,12 @@ dependencies:
96
95
  - 9
97
96
  - 2
98
97
  version: 0.9.2
98
+ requirement: *id005
99
99
  type: :development
100
- version_requirements: *id005
101
100
  - !ruby/object:Gem::Dependency
102
101
  name: sqlite3-ruby
103
102
  prerelease: false
104
- requirement: &id006 !ruby/object:Gem::Requirement
103
+ version_requirements: &id006 !ruby/object:Gem::Requirement
105
104
  none: false
106
105
  requirements:
107
106
  - - ~>
@@ -112,12 +111,12 @@ dependencies:
112
111
  - 3
113
112
  - 2
114
113
  version: 1.3.2
114
+ requirement: *id006
115
115
  type: :development
116
- version_requirements: *id006
117
116
  - !ruby/object:Gem::Dependency
118
117
  name: pry
119
118
  prerelease: false
120
- requirement: &id007 !ruby/object:Gem::Requirement
119
+ version_requirements: &id007 !ruby/object:Gem::Requirement
121
120
  none: false
122
121
  requirements:
123
122
  - - "="
@@ -129,12 +128,12 @@ dependencies:
129
128
  - 6
130
129
  - 2
131
130
  version: 0.9.6.2
131
+ requirement: *id007
132
132
  type: :development
133
- version_requirements: *id007
134
133
  - !ruby/object:Gem::Dependency
135
134
  name: shoulda
136
135
  prerelease: false
137
- requirement: &id008 !ruby/object:Gem::Requirement
136
+ version_requirements: &id008 !ruby/object:Gem::Requirement
138
137
  none: false
139
138
  requirements:
140
139
  - - ">="
@@ -143,12 +142,12 @@ dependencies:
143
142
  segments:
144
143
  - 0
145
144
  version: "0"
145
+ requirement: *id008
146
146
  type: :development
147
- version_requirements: *id008
148
147
  - !ruby/object:Gem::Dependency
149
148
  name: mocha
150
149
  prerelease: false
151
- requirement: &id009 !ruby/object:Gem::Requirement
150
+ version_requirements: &id009 !ruby/object:Gem::Requirement
152
151
  none: false
153
152
  requirements:
154
153
  - - ">="
@@ -157,8 +156,8 @@ dependencies:
157
156
  segments:
158
157
  - 0
159
158
  version: "0"
159
+ requirement: *id009
160
160
  type: :development
161
- version_requirements: *id009
162
161
  description: integrate the elastic search engine with rails
163
162
  email:
164
163
  - ryan@codecrate.com
@@ -191,7 +190,6 @@ files:
191
190
  - test/helper.rb
192
191
  - test/setup_database.rb
193
192
  - test/test_elastic_searchable.rb
194
- has_rdoc: true
195
193
  homepage: http://github.com/socialcast/elastic_searchable
196
194
  licenses: []
197
195
 
@@ -221,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
219
  requirements: []
222
220
 
223
221
  rubyforge_project: elastic_searchable
224
- rubygems_version: 1.5.3
222
+ rubygems_version: 1.8.5
225
223
  signing_key:
226
224
  specification_version: 3
227
225
  summary: elastic search for activerecord