pattern_query_helper 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a793c720df496cc279d3d86683056cc0193cd9ce
4
- data.tar.gz: 89b26c1e5e760a05d22f8cd99cc4027bf63c6bd1
3
+ metadata.gz: 00f3d3a35d3c3e1123335893dce1b17183837755
4
+ data.tar.gz: 9501bcba0adb2f201071cf838bbbf8b96a0fd78c
5
5
  SHA512:
6
- metadata.gz: '021168529aaef384c4c32c5d632aebf035a015f15f5f3d7f28fd25225c3829f4b97c41b9ec9b280d203c6dee71e95c3ffd505aad470bb7e84f1b77857df2d131'
7
- data.tar.gz: 4193cdd182b61699046e1fd1108eb12815246022aae9eef75a89e0a347625633c06e2cf369bcc5a6dd78142ab7d17017625b2100b975600d6945f9f0f68c4932
6
+ metadata.gz: bde00eec48f1826ef48947c52ebe0bac4c1f7c8c3050e9adfdddbfbfc0a096cfc4b43a0bb8e879be8109f2482e7fa394a6f839d991264e0ff60456dc0dc21e27
7
+ data.tar.gz: 9d668688ad2f803a8316c9efcca8522eed6bada340dea22a7afcd05eb596eb8ff9b955b6f05146850168f9e55a306ea4e8995f185f16d3b953e35a937f7eafd2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pattern_query_helper (0.1.3)
4
+ pattern_query_helper (0.1.4)
5
5
  activerecord (~> 5.0)
6
6
  kaminari
7
7
 
@@ -5,7 +5,11 @@ module PatternQueryHelper
5
5
  if params[:sort]
6
6
  sorts = params[:sort].split(",")
7
7
  sorts.each_with_index do |sort, index|
8
- if sort.split(":")[1] == "desc"
8
+ column = sort.split(":")[0]
9
+ direction = sort.split(":")[1]
10
+ modifier = sort.split(":")[2]
11
+
12
+ if direction == "desc"
9
13
  case PatternQueryHelper.active_record_adapter
10
14
  when "sqlite3"
11
15
  direction = "desc"
@@ -15,7 +19,13 @@ module PatternQueryHelper
15
19
  else
16
20
  direction = "asc"
17
21
  end
18
- sort_sql << "#{sort.split(":")[0]} #{direction}"
22
+
23
+ case modifier
24
+ when "lowercase"
25
+ column = "lower(#{column})"
26
+ end
27
+
28
+ sort_sql << "#{column} #{direction}"
19
29
  end
20
30
  end
21
31
  sort_sql.join(", ")
@@ -1,3 +1,3 @@
1
1
  module PatternQueryHelper
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pattern_query_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan McDaniel