jsonapi.rb 1.3.0 → 1.3.1

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: 84c4daefc4822fcbaf912d9bbf500fa8db752bc2
4
- data.tar.gz: 3a338f497562d61ee01ccdb889fa309ccc2ebbdf
3
+ metadata.gz: 0ec031ad563f89982fddaaf7afc0c52e0416a6d0
4
+ data.tar.gz: 8a4bb4623d4f6296653e03ff3f5a2071040a4bc8
5
5
  SHA512:
6
- metadata.gz: 0da896b2305034b5f448b440db0b93ec67155fdfc707c535328c045c679686b113de9511dd5d9761cf1cced8230776ab47ed85914258440a5b7d76e15e203254
7
- data.tar.gz: 8f49760c1227c2017b74106fd3b47b64382aa46892114b54ba4db525fabe384ce6fd49ebe87bfdee69afbdec0aa0263ae39b249b0ceed78b2c2643f5fdde8088
6
+ metadata.gz: 196edb74a5cc741e98d60dd0a0c1ad7c68bf785d604212c9bd1e9a59e544245ff75bd9f2d2fd800263f1ebc764f54a9ff5020bc722d0f06bc1cad39477101f21
7
+ data.tar.gz: 0f7407d78935639d366ba3473d86833984e742020f252574ff074817de35f2595828c5837b5bc42af4ed282a94bb2ae4b69a6b2888fc5cb92a24bd0babd56239
@@ -8,7 +8,7 @@ GIT
8
8
  PATH
9
9
  remote: .
10
10
  specs:
11
- jsonapi.rb (1.3.0)
11
+ jsonapi.rb (1.3.1)
12
12
  fast_jsonapi (~> 1.5)
13
13
  rack
14
14
  ransack
data/README.md CHANGED
@@ -208,6 +208,12 @@ jsonapi_filter(User.all, allowed_fields, options) do |filtered|
208
208
  end
209
209
  ```
210
210
 
211
+ This allows you to run queries like:
212
+
213
+ ```bash
214
+ $ curl -X GET /api/resources?sort=-model_attr_sum
215
+ ```
216
+
211
217
  ### Pagination
212
218
 
213
219
  `JSONAPI::Pagination` provides support for paginating model record sets as long
@@ -33,7 +33,6 @@ Ransack.configure do |config|
33
33
  )
34
34
  end
35
35
 
36
-
37
36
  Ransack::Visitor.class_eval do
38
37
  alias_method :original_visit_Ransack_Nodes_Sort, :visit_Ransack_Nodes_Sort
39
38
 
@@ -49,7 +48,9 @@ Ransack::Visitor.class_eval do
49
48
  # Fallback to support the expressions...
50
49
  binded = Ransack::Nodes::Condition.extract(node.context, node.name, nil)
51
50
  valid = (binded.valid? if binded.respond_to?(:valid?)) || true
52
- binded.arel_predicate if binded.present? && valid
51
+ return unless binded.present? && valid
52
+
53
+ binded.arel_predicate.public_send(node.dir)
53
54
  end
54
55
  end
55
56
 
@@ -1,3 +1,3 @@
1
1
  module JSONAPI
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Suscov