pattern_query_helper 0.2.9 → 0.2.10

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
  SHA256:
3
- metadata.gz: 10af9c203e320ad1961805cf826cb69ca3e29173cdd64355bca34c8e08eda8b7
4
- data.tar.gz: e19a35f891552bebc7663aebc8b0c20304176886a5ec98bd8b8dbed0d5d616d5
3
+ metadata.gz: 0f7b769fe7f7c872ae4687971e2b6c584be215602b487b59cc703ef07fdbd33e
4
+ data.tar.gz: 842ca189e4f4d454c8b73ba07eb9eb116b8f1a29361b64ddad5cef94abca5db4
5
5
  SHA512:
6
- metadata.gz: 17251b8221f337b28bbbcb14e7706d7f306a6bfee68267e6e3c3b3e536a2435e1d619b74bead4ab82c59b14610f34d5604d48517def8d116dc6991fd9323ca24
7
- data.tar.gz: b31780c640f830a060999ded53ce25f28aa672d6142e976c2e4bc6b4f9bf707cf0547db2d28bdf4b8e45952a68ce50d2f3d97b17bc92440b443a7e61bc0587e7
6
+ metadata.gz: fe96140d39459acc61d3dba075bc87b2068c9e7c686ef2d1e013b1f4026055ff2ab440246cf14ea9f870de975f5fbabf5eb2edd3a1719922b2fdc9f0fac44374
7
+ data.tar.gz: dda789624d5ef4d5f6239659cc268b7348f26f52c1ca428936c712424be78a3dde297aad937adfb85f0a7c2018dc72fa6e72070f489a3adbbcbf6f5e65b21259
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pattern_query_helper (0.2.8)
4
+ pattern_query_helper (0.2.9)
5
5
  activerecord (~> 5.0)
6
6
  kaminari (~> 1.1.1)
7
7
 
@@ -94,7 +94,7 @@ module PatternQueryHelper
94
94
  valid_columns.each do |c|
95
95
  valid_columns_map["#{c}"] = c
96
96
  end
97
- filtering = PatternQueryHelper::Filtering.create_filters(query_helpers[:filter], valid_columns_map)
97
+ filtering = PatternQueryHelper::Filtering.create_filters(filters: query_helpers[:filter], valid_columns_map: valid_columns_map)
98
98
  sorting = PatternQueryHelper::Sorting.parse_sorting_params(query_helpers[:sort], valid_columns)
99
99
  associations = PatternQueryHelper::Associations.process_association_params(query_helpers[:include])
100
100
  pagination = PatternQueryHelper::Pagination.parse_pagination_params(query_helpers[:page], query_helpers[:per_page])
@@ -1,6 +1,6 @@
1
1
  module PatternQueryHelper
2
2
  class Filtering
3
- def self.create_filters(filters, valid_columns_map=nil, symbol_prefix="")
3
+ def self.create_filters(filters:, valid_columns_map: nil, symbol_prefix: "", include_where: true)
4
4
  filters ||= {}
5
5
  all_conditions = []
6
6
  filter_params = {}
@@ -67,8 +67,11 @@ module PatternQueryHelper
67
67
  end
68
68
  end
69
69
 
70
- filter_string = ""
71
- filter_string = "where " + all_conditions.join("\n and ") unless all_conditions.empty?
70
+ if include_where
71
+ filter_string = "where " + all_conditions.join("\n and ") unless all_conditions.empty?
72
+ else
73
+ filter_string = all_conditions.empty? ? "1 = 1" : all_conditions.join("\n and ")
74
+ end
72
75
 
73
76
  {
74
77
  filter_string: filter_string,
@@ -1,3 +1,3 @@
1
1
  module PatternQueryHelper
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
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.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan McDaniel