Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated has_field? with field? to support Protobuf 4.0 #19

Merged
merged 1 commit into from
Sep 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/protobuf/active_record/transformation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _filter_attribute_fields(proto)
fields = proto.to_hash
fields.select! do |key, value|
field = proto.class.get_field(key, true)
proto.has_field?(key) && !field.repeated?
proto.field?(key) && !field.repeated?
end

filtered_attributes = _filtered_attributes + _protobuf_nested_attributes
Expand Down
4 changes: 2 additions & 2 deletions spec/support/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class User < ActiveRecord::Base
attribute_from_proto :password, lambda { |proto| proto.password! }

def self.extract_first_name(proto)
if proto.has_field?(:name)
if proto.field?(:name)
names = proto.name.split(" ")
first_name = names.first
end
Expand All @@ -20,7 +20,7 @@ def self.extract_first_name(proto)
end

def self.extract_last_name(proto)
if proto.has_field?(:name)
if proto.field?(:name)
names = proto.name.split(" ")
names.shift # Drop the first name
last_name = names.join(" ")
Expand Down