gpi-active_model_serializers 0.8.3.rc1 → 0.8.4.alpha1
Sign up to get free protection for your applications and to get access to all the features.
@@ -63,6 +63,9 @@ module ActiveModel
|
|
63
63
|
class_attribute :_attributes
|
64
64
|
self._attributes = {}
|
65
65
|
|
66
|
+
class_attribute :_hidden_attributes
|
67
|
+
self._hidden_attributes = []
|
68
|
+
|
66
69
|
class_attribute :_associations
|
67
70
|
self._associations = {}
|
68
71
|
|
@@ -93,6 +96,11 @@ module ActiveModel
|
|
93
96
|
end
|
94
97
|
end
|
95
98
|
|
99
|
+
def hidden_attributes(*attrs)
|
100
|
+
self._hidden_attributes.concat(attrs)
|
101
|
+
attributes(*attrs)
|
102
|
+
end
|
103
|
+
|
96
104
|
def attribute(attr, options={})
|
97
105
|
self._attributes = _attributes.merge(attr.is_a?(Hash) ? attr : {attr => options[:key] || attr.to_s.gsub(/\?$/, '').to_sym})
|
98
106
|
|
@@ -425,6 +433,7 @@ module ActiveModel
|
|
425
433
|
method << " h = {}\n"
|
426
434
|
|
427
435
|
_attributes.each do |name,key|
|
436
|
+
next if _hidden_attributes.include?(name) && !include?(name)
|
428
437
|
method << " h[:\"#{key}\"] = read_attribute_for_serialization(:\"#{name}\") if include?(:\"#{name}\")\n"
|
429
438
|
end
|
430
439
|
method << " h\nend"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpi-active_model_serializers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4.alpha1
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-06-
|
13
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|