nested 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/lib/nested.rb +19 -7
- data/nested.gemspec +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: 99b658c995d93d8b0dda8b3c9d37ad960ed05479
|
4
|
+
data.tar.gz: 530220cfb3d7ea5009306e39c07ca8631abaf0fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e34af8825ff7696e5d8f16bda06e5f5084c01bb2d0aad3f9a5ea9154477394f7449a4a4c2e7796da53aca8f94f55a93cb51899606eaeebf99a9f5d9b321f50f
|
7
|
+
data.tar.gz: d874154cb151c301db00cab8e6d895969068e2d1af7f772966005611602f396b50a7974d8d3a6e8d686a763d941aecfe9eae7bc15bbf01a796d25a143571dbf7
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (4.0.
|
5
|
-
activesupport (= 4.0.
|
4
|
+
activemodel (4.0.2)
|
5
|
+
activesupport (= 4.0.2)
|
6
6
|
builder (~> 3.1.0)
|
7
|
-
activerecord (4.0.
|
8
|
-
activemodel (= 4.0.
|
7
|
+
activerecord (4.0.2)
|
8
|
+
activemodel (= 4.0.2)
|
9
9
|
activerecord-deprecated_finders (~> 1.0.2)
|
10
|
-
activesupport (= 4.0.
|
10
|
+
activesupport (= 4.0.2)
|
11
11
|
arel (~> 4.0.0)
|
12
12
|
activerecord-deprecated_finders (1.0.3)
|
13
|
-
activesupport (4.0.
|
13
|
+
activesupport (4.0.2)
|
14
14
|
i18n (~> 0.6, >= 0.6.4)
|
15
15
|
minitest (~> 4.2)
|
16
16
|
multi_json (~> 1.3)
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
arel (4.0.1)
|
20
20
|
atomic (1.1.14)
|
21
21
|
builder (3.1.4)
|
22
|
-
i18n (0.6.
|
22
|
+
i18n (0.6.9)
|
23
23
|
json (1.8.1)
|
24
24
|
metaclass (0.0.1)
|
25
25
|
minitest (4.7.5)
|
data/lib/nested.rb
CHANGED
@@ -297,7 +297,6 @@ module Nested
|
|
297
297
|
puts "sinatra router [#{method}] #{@sinatra.nested_config[:prefix]}#{route}"
|
298
298
|
|
299
299
|
@sinatra.send(method, route) do
|
300
|
-
|
301
300
|
def self.error(message)
|
302
301
|
errors.add(:base, message)
|
303
302
|
end
|
@@ -306,15 +305,28 @@ module Nested
|
|
306
305
|
@__errors ||= ActiveModel::Errors.new({})
|
307
306
|
end
|
308
307
|
|
309
|
-
|
308
|
+
begin
|
309
|
+
content_type :json
|
310
310
|
|
311
|
-
|
312
|
-
|
313
|
-
|
311
|
+
resource.self_and_parents.reverse.each do |res|
|
312
|
+
res.sinatra_init(self)
|
313
|
+
end
|
314
314
|
|
315
|
-
|
315
|
+
resource.send(:"sinatra_exec_#{method}_block", self, &block)
|
316
316
|
|
317
|
-
|
317
|
+
resource.sinatra_response(self, method)
|
318
|
+
rescue Exception => e
|
319
|
+
context_arr = []
|
320
|
+
context_arr << "route: #{route}"
|
321
|
+
context_arr << "method: #{method}"
|
322
|
+
context_arr << "action: #{action}"
|
323
|
+
context_arr << "resource: #{resource.name} (#{resource.type})"
|
324
|
+
|
325
|
+
resource_object = instance_variable_get("@#{resource.instance_variable_name}")
|
326
|
+
context_arr << "@#{resource.instance_variable_name}: #{resource_object.inspect}"
|
327
|
+
puts context_arr.join("\n")
|
328
|
+
raise e
|
329
|
+
end
|
318
330
|
end
|
319
331
|
end
|
320
332
|
end
|
data/nested.gemspec
CHANGED