Skip to content

Commit

Permalink
fix association reload
Browse files Browse the repository at this point in the history
  • Loading branch information
plribeiro3000 committed Oct 2, 2017
1 parent 13979be commit 94d12c4
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/fog/core/model.rb
Expand Up @@ -44,17 +44,13 @@ def ==(o)
def reload
requires :identity

data = begin
collection.get(identity)
rescue Excon::Errors::SocketError
nil
end
object = collection.get(identity)

return unless data
merge_attributes(object.all_associations_and_attributes)

new_attributes = data.attributes
merge_attributes(new_attributes)
self
rescue Excon::Errors::SocketError
nil
end

def to_json(_options = {})
Expand Down

0 comments on commit 94d12c4

Please sign in to comment.