elocal_api_support 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/elocal_api_support/actions/update.rb +11 -1
- data/lib/elocal_api_support/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 455780104403fda2d28072b536aaaf848e4c2ef5
|
4
|
+
data.tar.gz: 06467ae9ce02d600906deefb1911e6b932a6878f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c148f0b6d4414b7aaf90ca08d7fd45f2911cebee78965a6f0d41ab30dfa007637849049b1e8ea91eceff4ed26f0750fc2c210ab5d1141e3c2e0ef3dfa7c0ba0
|
7
|
+
data.tar.gz: 0aca16e0dda837efa4a372bb4c0ec9bf06b9dd417f59d3807bc8d39dd429dd262c0a2b5841708ffd53da23961754823d3ae2d6fc71d936f1efc4c3d9ad1b34ea
|
@@ -3,12 +3,22 @@ module ElocalApiSupport
|
|
3
3
|
module Update
|
4
4
|
def update
|
5
5
|
params.permit!
|
6
|
-
if lookup_object.update_attributes(
|
6
|
+
if lookup_object.update_attributes(parameters_available_for_update)
|
7
7
|
render json: lookup_object
|
8
8
|
else
|
9
9
|
render json: { errors: lookup_object.errors }, status: 422
|
10
10
|
end
|
11
11
|
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def parameters_available_for_update
|
16
|
+
params[associated_model_name].reject { |(k, _v)| k.in?(parameters_to_ignore_from_update) }
|
17
|
+
end
|
18
|
+
|
19
|
+
def parameters_to_ignore_from_update
|
20
|
+
%w(id created_at updated_at).freeze
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
14
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elocal_api_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Di Marco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
requirements: []
|
175
175
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.4.
|
176
|
+
rubygems_version: 2.4.8
|
177
177
|
signing_key:
|
178
178
|
specification_version: 4
|
179
179
|
summary: Utilities for controllers when creating a JSON API
|
@@ -182,4 +182,3 @@ test_files:
|
|
182
182
|
- spec/fixtures/application.rb
|
183
183
|
- spec/fixtures/controllers.rb
|
184
184
|
- spec/spec_helper.rb
|
185
|
-
has_rdoc:
|