Skip to content

Commit

Permalink
update exist? test
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Feb 28, 2023
1 parent 46d1b9f commit a998a4e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/goo/base/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,19 @@ def modified?
end

def exist?(from_valid = false)

_id = generate_id
if _id.nil? && !from_valid && self.class.name_with.is_a?(Symbol)
begin
_id = id_from_attribute()
id unless self.class.name_with.kind_of?(Symbol)
rescue IDGenerationError
# Ignored
end

_id = @id
if from_valid || _id.nil?
_id = generate_id rescue _id = nil
end

return false unless _id
return Goo::SPARQL::Queries.model_exist(self, id = _id)
Goo::SPARQL::Queries.model_exist(self, id = _id)
end

def fully_loaded?
Expand Down

0 comments on commit a998a4e

Please sign in to comment.