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.
Files changed (2) hide show
  1. data/lib/sinatra/rest/rest.yaml +10 -2
  2. metadata +2 -2
@@ -22,7 +22,11 @@
22
22
  @SINGULAR = call_model_method(MODEL, :new, mp)
23
23
  @SINGULAR.save
24
24
  :render: |-
25
- redirect url_for_PLURAL_show(@SINGULAR), 'SINGULAR created'
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
- redirect url_for_PLURAL_show(@SINGULAR), 'SINGULAR updated'
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:
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 7
9
- version: 0.3.7
8
+ - 8
9
+ version: 0.3.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - blindgaenger