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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/jsonapi/patches.rb +3 -2
- data/lib/jsonapi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ec031ad563f89982fddaaf7afc0c52e0416a6d0
|
4
|
+
data.tar.gz: 8a4bb4623d4f6296653e03ff3f5a2071040a4bc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196edb74a5cc741e98d60dd0a0c1ad7c68bf785d604212c9bd1e9a59e544245ff75bd9f2d2fd800263f1ebc764f54a9ff5020bc722d0f06bc1cad39477101f21
|
7
|
+
data.tar.gz: 0f7407d78935639d366ba3473d86833984e742020f252574ff074817de35f2595828c5837b5bc42af4ed282a94bb2ae4b69a6b2888fc5cb92a24bd0babd56239
|
data/Gemfile.lock
CHANGED
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
|
data/lib/jsonapi/patches.rb
CHANGED
@@ -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
|
-
|
51
|
+
return unless binded.present? && valid
|
52
|
+
|
53
|
+
binded.arel_predicate.public_send(node.dir)
|
53
54
|
end
|
54
55
|
end
|
55
56
|
|
data/lib/jsonapi/version.rb
CHANGED