rails-add_ons 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dabbd8a63d9974add6f3eb7a977852565273e302
|
|
4
|
+
data.tar.gz: 2cec9a303127acf1bd21db8fb67c3be9b28a65ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 755c1684e59fce44d3ec8beff99fbf8699e9c44ba75e1827e43cf646ff952c23422dbdd60b0f0fc80dc4f7044dfb7df98aba1d79bc99fcd69969a755e27c2184
|
|
7
|
+
data.tar.gz: ef4fa636b37c73f4c1a48b8b608277e7c7cf0199d72ebb70cecf0765b9bc145240087421fb2115b6990479438e4bf0638867f5c9bddb882a8bd5d51e7b4600d2
|
|
@@ -6,10 +6,20 @@ module ApiControllerConcerns
|
|
|
6
6
|
rescue_from Exception do |exception|
|
|
7
7
|
handle_exception(exception)
|
|
8
8
|
end
|
|
9
|
+
|
|
10
|
+
rescue_from ActiveRecord::RecordNotFound do |exception|
|
|
11
|
+
handle_404(exception)
|
|
12
|
+
end
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
private
|
|
12
16
|
|
|
17
|
+
def handle_404(exception = nil)
|
|
18
|
+
respond_to do |format|
|
|
19
|
+
format.json { render json: { error: (exception.try(:message) || 'Not found') }, status: 404 }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
13
23
|
def handle_exception(exception)
|
|
14
24
|
if Rails.env.development? || Rails.env.test?
|
|
15
25
|
error = { message: exception.message }
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-add_ons
|
|
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
|
- Roberto Vasquez Angel
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-02-
|
|
11
|
+
date: 2018-02-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|