go-on-rails 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4885ebf7ebb9df3a3c2941dd88966f28384975a1
4
- data.tar.gz: 71d6fca3d339378f36105063de928ed2f3620d0a
3
+ metadata.gz: a24ab99957a404da499992b20120d30c163c5925
4
+ data.tar.gz: 5009bffa97b30a0bef1209ab1b1b12bd5ec727fa
5
5
  SHA512:
6
- metadata.gz: 86055cbc92c586e8c1764f392f2bc1ca895faee9b3b0933a3c88c87ea58199bdabfd2b24853a55a9b6b46b51f7bb316e470c9d3004cac3d29b344b4f46390154
7
- data.tar.gz: a835298ceea075195217320032977be3530b1dad25aa1233f72ba34d33553e64ed581bdaa248f4c692b3d69b2c325730bd6edd81af92339d9afe930f79b8ae27
6
+ metadata.gz: 411466805ddf6f18e0797127a25cb30a9458bf5d3143b5fa3a8de2dadafd6ceeb6d385968ed96be02804ca311b73912dca0da3e1f02a329fa8548e272e47dcd6
7
+ data.tar.gz: 40ddc1ef5a221c2141820ded808ec501e8064df288c92dec7c45ee75b385e91811ed2e2e04409d745144c570ccbd57e8c7a112ef6b6c7e0e849aa117908b4f6a
data/README.md CHANGED
@@ -23,7 +23,7 @@ Here's a simple [example(tutorial)](https://github.com/goonr/example_simple) sho
23
23
  Add this line to your application's Gemfile:
24
24
 
25
25
  ```ruby
26
- gem 'go-on-rails', '~> 0.1.4'
26
+ gem 'go-on-rails', '~> 0.1.6'
27
27
  ```
28
28
 
29
29
  And then execute:
@@ -101,6 +101,7 @@ And the gem is still under development, so there're a lot of known issues.
101
101
  - [x] format(string only)
102
102
  - [x] numericality(partially)
103
103
  - [ ] other validations
104
+ - [x] Pagination(details see [wiki](https://github.com/goonr/go-on-rails/wiki/Pagination))
104
105
  - [ ] Callbacks
105
106
  - [ ] Transactions
106
107
 
@@ -155,34 +155,37 @@ func (_p *<%= @model_name %>Page) buildIdRestrict(direction string) (idStr strin
155
155
  case "previous":
156
156
  if strings.ToLower(_p.Order["id"]) == "desc" {
157
157
  idStr += "id > ? "
158
- idParams = append(_p.WhereParams, _p.FirstId)
158
+ idParams = append(idParams, _p.FirstId)
159
159
  } else {
160
160
  idStr += "id < ? "
161
- idParams = append(_p.WhereParams, _p.FirstId)
161
+ idParams = append(idParams, _p.FirstId)
162
162
  }
163
163
  case "current":
164
164
  // trick to make Where function work
165
165
  if _p.PageNum == 0 && _p.FirstId == 0 && _p.LastId == 0 {
166
166
  idStr += "id > ? "
167
- idParams = append(_p.WhereParams, 0)
167
+ idParams = append(idParams, 0)
168
168
  } else {
169
169
  if strings.ToLower(_p.Order["id"]) == "desc" {
170
170
  idStr += "id <= ? AND id >= ? "
171
- idParams = append(_p.WhereParams, _p.FirstId, _p.LastId)
171
+ idParams = append(idParams, _p.FirstId, _p.LastId)
172
172
  } else {
173
173
  idStr += "id >= ? AND id <= ? "
174
- idParams = append(_p.WhereParams, _p.FirstId, _p.LastId)
174
+ idParams = append(idParams, _p.FirstId, _p.LastId)
175
175
  }
176
176
  }
177
177
  case "next":
178
178
  if strings.ToLower(_p.Order["id"]) == "desc" {
179
179
  idStr += "id < ? "
180
- idParams = append(_p.WhereParams, _p.LastId)
180
+ idParams = append(idParams, _p.LastId)
181
181
  } else {
182
182
  idStr += "id > ? "
183
- idParams = append(_p.WhereParams, _p.LastId)
183
+ idParams = append(idParams, _p.LastId)
184
184
  }
185
185
  }
186
+ if _p.WhereString != "" {
187
+ idStr = " AND " + idStr
188
+ }
186
189
  return
187
190
  }
188
191
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go-on-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - B1nj0y