protobuf-activerecord 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,7 +28,7 @@ module Protoable
28
28
  fields = proto.to_hash
29
29
  fields.select! { |key, value| proto.has_field?(key) && !proto.get_field_by_name(key).repeated? }
30
30
 
31
- attribute_fields = attribute_names.inject({}) do |hash, column_name|
31
+ attribute_fields = _filtered_attributes.inject({}) do |hash, column_name|
32
32
  symbolized_column = column_name.to_sym
33
33
 
34
34
  if fields.has_key?(symbolized_column) ||
@@ -42,6 +42,18 @@ module Protoable
42
42
  attribute_fields
43
43
  end
44
44
 
45
+ # Filters protected attributes from the available attributes list. When
46
+ # set through accessible attributes, returns the accessible attributes.
47
+ # When set through protected attributes, returns the attributes minus any
48
+ # protected attributes.
49
+ #
50
+ # :nodoc:
51
+ def _filtered_attributes
52
+ return accessible_attributes.to_a if accessible_attributes.present?
53
+
54
+ return self.attribute_names - protected_attributes.to_a
55
+ end
56
+
45
57
  # :nodoc:
46
58
  def _protobuf_convert_fields_to_columns(key, value)
47
59
  return value if value.nil?
@@ -1,5 +1,5 @@
1
1
  module Protobuf
2
2
  module ActiveRecord
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protobuf-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -239,7 +239,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
239
  version: '0'
240
240
  segments:
241
241
  - 0
242
- hash: 1889653125462777253
242
+ hash: -468184549556839603
243
243
  required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  none: false
245
245
  requirements:
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  segments:
250
250
  - 0
251
- hash: 1889653125462777253
251
+ hash: -468184549556839603
252
252
  requirements: []
253
253
  rubyforge_project:
254
254
  rubygems_version: 1.8.25