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 +4 -4
- data/lib/softwear/lib/api_controller.rb +6 -18
- data/lib/softwear/lib/version.rb +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: 6287549238cbaf4234bf105f4c29603a92da831d
|
4
|
+
data.tar.gz: 008274d1e82cb962b4e27d3e6e80cdff86cd324f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
data/lib/softwear/lib/version.rb
CHANGED