softwear-lib 1.3.9 → 1.3.10

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: a16fc14031cac730829f23356c7781374fcc6d64
4
- data.tar.gz: e11ff2c002e243127382aa6beec966a286b5b3c3
3
+ metadata.gz: 6287549238cbaf4234bf105f4c29603a92da831d
4
+ data.tar.gz: 008274d1e82cb962b4e27d3e6e80cdff86cd324f
5
5
  SHA512:
6
- metadata.gz: 86547b42a86e68d5ffb8978fc73caee10715cec443b67f7d37bffb135e38832906fa4829efb193bcaf62911367840d7660fc05c9c395d49a913d109cf14b5a7f
7
- data.tar.gz: 05ba636a08ff28c899b8cd318c92d545cd5e0a57d93416b15c71ff16abccfffe7901f17910763815269333a2f6c0bb308cb309358441bb57351067692b9c319d
6
+ metadata.gz: 829c3ae615723bce3c768922ba295840d71f6c6ad86643a5fca6bf9eb1d725b38bfa59dbe0ea3f65b5ec4c6351719252179ecdd28b96d4475a7a21c4539a3c44
7
+ data.tar.gz: 77422583ccb535ea719d5c7ae9c44e70c4e8c34e6d3d99766a7c99985036f834a5e794f519f965162c892b1d3990b3c87ef2270560fbff942ed75e526c7934aa
@@ -12,7 +12,6 @@ module Softwear
12
12
  skip_before_filter :verify_authenticity_token
13
13
 
14
14
  before_filter :allow_origin
15
- before_filter :remove_model_name_from_params, only: [:create, :update]
16
15
 
17
16
  respond_to :json
18
17
  self.responder = InheritedResources::Responder
@@ -57,17 +56,12 @@ module Softwear
57
56
  end
58
57
 
59
58
  def create
60
- self.record = resource_class.new
61
-
62
- permitted_attributes.each do |a|
63
- record.send("#{a}=", params[a]) if params[a]
64
- end
65
-
66
- if record.save
67
- headers['Location'] = resource_url(record.id)
68
- respond_to { |format| format.json(&render_json(status: 201)) }
69
- else
70
- respond_to { |format| format.json(&render_errors) }
59
+ create! do |success, failure|
60
+ success.json do
61
+ headers['Location'] = resource_url(record.id)
62
+ render_json(status: 201).call
63
+ end
64
+ failure.json(&render_errors)
71
65
  end
72
66
  end
73
67
 
@@ -147,12 +141,6 @@ module Softwear
147
141
  def permitted_params
148
142
  { resource_class.model_name.element => permitted_attributes }
149
143
  end
150
-
151
- def remove_model_name_from_params
152
- if params[resource_class.model_name.element]
153
- params.merge!(params[resource_class.model_name.element])
154
- end
155
- end
156
144
  end
157
145
  end
158
146
  end
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Lib
3
- VERSION = "1.3.9"
3
+ VERSION = "1.3.10"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: softwear-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Baillie