dominiquebrezinski-sinatra-rest 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sinatra/rest/rest.yaml +10 -2
- metadata +2 -2
data/lib/sinatra/rest/rest.yaml
CHANGED
@@ -22,7 +22,11 @@
|
|
22
22
|
@SINGULAR = call_model_method(MODEL, :new, mp)
|
23
23
|
@SINGULAR.save
|
24
24
|
:render: |-
|
25
|
-
|
25
|
+
unless @SINGULAR.invalid?
|
26
|
+
redirect url_for_PLURAL_show(@SINGULAR), 'SINGULAR created'
|
27
|
+
else
|
28
|
+
throw :halt, [500, @SINGULAR.errors.full_messages.join("\n")]
|
29
|
+
end
|
26
30
|
|
27
31
|
:show:
|
28
32
|
:verb: GET
|
@@ -54,7 +58,11 @@
|
|
54
58
|
if @SINGULAR.nil?
|
55
59
|
throw :halt, [404, 'SINGULAR not found']
|
56
60
|
else
|
57
|
-
|
61
|
+
unless @SINGULAR.invalid?
|
62
|
+
redirect url_for_PLURAL_show(@SINGULAR), 'SINGULAR updated'
|
63
|
+
else
|
64
|
+
throw :halt, [500, @SINGULAR.errors.full_messages.join("\n")]
|
65
|
+
end
|
58
66
|
end
|
59
67
|
|
60
68
|
:destroy:
|