jsonapi.rb 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jsonapi/filtering.rb +0 -1
- data/lib/jsonapi/rails.rb +3 -3
- data/lib/jsonapi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d531366279855044f83d35f4526a72156c711895290ab4dbce73f1c7615f1079
|
4
|
+
data.tar.gz: 63bd2be61a78d79a64bc739cbb492ee75a9e2f90a95389d55f133a2565627abb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e602d6c993cd0259ac0b81c57eca16aee525f53ed0e5b4ac8014a0cb500528d579541375ce7735f0f191f3f732af9178ebbfdf7d4615eb967cfb244d1796cd36
|
7
|
+
data.tar.gz: 46a957ded4247be1607f6a4d84246da42a44fe41c58c55e2a34a914e958a28731531bc5e8a3f0d0141f571e17dce19c9c1f6f58845fc3e7db874d763dfcaffbb
|
data/lib/jsonapi/filtering.rb
CHANGED
data/lib/jsonapi/rails.rb
CHANGED
@@ -37,7 +37,7 @@ module JSONAPI
|
|
37
37
|
# @return [NilClass]
|
38
38
|
def self.add_errors_renderer!
|
39
39
|
ActionController::Renderers.add(:jsonapi_errors) do |resource, options|
|
40
|
-
self.content_type
|
40
|
+
self.content_type = Mime[:jsonapi] if self.media_type.nil?
|
41
41
|
|
42
42
|
many = JSONAPI::Rails.is_collection?(resource, options[:is_collection])
|
43
43
|
resource = [resource] unless many
|
@@ -90,7 +90,7 @@ module JSONAPI
|
|
90
90
|
# @return [NilClass]
|
91
91
|
def self.add_renderer!
|
92
92
|
ActionController::Renderers.add(:jsonapi) do |resource, options|
|
93
|
-
self.content_type
|
93
|
+
self.content_type = Mime[:jsonapi] if self.media_type.nil?
|
94
94
|
|
95
95
|
JSONAPI_METHODS_MAPPING.to_a[0..1].each do |opt, method_name|
|
96
96
|
next unless respond_to?(method_name, true)
|
@@ -100,7 +100,7 @@ module JSONAPI
|
|
100
100
|
# If it's an empty collection, return it directly.
|
101
101
|
many = JSONAPI::Rails.is_collection?(resource, options[:is_collection])
|
102
102
|
if many && !resource.any?
|
103
|
-
return options.slice(:meta, :links).merge(data: []).to_json
|
103
|
+
return options.slice(:meta, :links).compact.merge(data: []).to_json
|
104
104
|
end
|
105
105
|
|
106
106
|
JSONAPI_METHODS_MAPPING.to_a[2..-1].each do |opt, method_name|
|
data/lib/jsonapi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas Suscov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsonapi-serializer
|
@@ -265,7 +265,7 @@ homepage: https://github.com/stas/jsonapi.rb
|
|
265
265
|
licenses:
|
266
266
|
- MIT
|
267
267
|
metadata: {}
|
268
|
-
post_install_message:
|
268
|
+
post_install_message: Install manually `ransack` gem before using `JSONAPI::Filtering`!
|
269
269
|
rdoc_options: []
|
270
270
|
require_paths:
|
271
271
|
- lib
|