Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Commit

Permalink
check before update attribute of basemodel
Browse files Browse the repository at this point in the history
  • Loading branch information
James Wong committed May 2, 2017
1 parent 9515317 commit 65626b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/ansible_tower_client/base_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ def self.create(*args)
def update_attributes!(attributes)
@api.patch(url, attributes.to_json)
attributes.each do |method_name, value|
if override_raw_attributes[method_name]
send("#{override_raw_attributes[method_name]}=", value)
else
send("#{method_name}=", value)
invoke_name = "#{override_raw_attributes[method_name] ? override_raw_attributes[method_name] : method_name}="
if respond_to?(invoke_name)
send(invoke_name, value)
end
end
true
Expand Down

0 comments on commit 65626b0

Please sign in to comment.