softwear-lib 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 864b5c964defd38d95f0babe1f777872d7447a15
4
- data.tar.gz: 81fd57e764ae6587640c8c3e440579fde2e9706d
3
+ metadata.gz: e90afc76e3b1165b82d91bb760e60feb43e2cd09
4
+ data.tar.gz: 12da3861f5450b3b88ac0557a56e7ad8d15f6202
5
5
  SHA512:
6
- metadata.gz: 67a6cf094bc25f28d52bbf4cde74b1eeb7b2098676b0274196bb257b74bf6878afcc5f507d790f3f1b8ad24952e85afce323cb58453e87821e398af59d36c782
7
- data.tar.gz: 9ca5a860d554af59229db8f9a1b7d663f27b72b0b3592638cc97fd132d511a0494456b49f9a4eb05bab7b6ae6d546486321d5397e29338279c4cfdb39b1e737b
6
+ metadata.gz: 5a87c65a04b1e92f2c334d1bad7449462d1aa91ada5b3a8264402150a6a3cf0f894009d819a717e7c1832fbf6ae6aaf59a500f29d3a22f8c34c708b3290103ab
7
+ data.tar.gz: dd75b6dc070a46296b2e02f78de390532f0ac037ce0ebb407b1d2fc99a213739e3b2d38ec67c382c113aba5a2353a32841725bf5ae6f6ed207e12277b9806445
@@ -42,8 +42,9 @@ module Softwear
42
42
  end
43
43
 
44
44
  def update
45
- super do |format|
46
- format.json(&render_json)
45
+ super do |success, failure|
46
+ success.json(&render_json)
47
+ failure.json(&render_errors)
47
48
  end
48
49
  end
49
50
 
@@ -53,7 +54,7 @@ module Softwear
53
54
  headers['Location'] = resource_url(record.id)
54
55
  render_json(status: 201).call
55
56
  end
56
- failure.json(&render_json)
57
+ failure.json(&render_errors)
57
58
  end
58
59
  end
59
60
 
@@ -82,6 +83,18 @@ module Softwear
82
83
  end
83
84
  end
84
85
 
86
+ def render_errors(options = {})
87
+ proc do
88
+ rendering = {
89
+ json: { errors: record.errors },
90
+ status: :unprocessable_entity
91
+ }
92
+ .merge(options)
93
+
94
+ render rendering
95
+ end
96
+ end
97
+
85
98
  def self.model_name
86
99
  name.gsub('Api::', '').gsub('Controller', '').singularize
87
100
  end
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Lib
3
- VERSION = "1.3.4"
3
+ VERSION = "1.3.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler