Skip to content

Commit

Permalink
Merge pull request #840 from projecthydra/refactor_eq
Browse files Browse the repository at this point in the history
Refactor File#== to avoid an unnecessary API call
  • Loading branch information
grosscol committed Jun 29, 2015
2 parents 5106c86 + d61986c commit 07c5cfd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/active_fedora/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ def initialize(parent_or_url_or_hash = nil, path=nil, options={})
end

def ==(comparison_object)
return true if comparison_object.equal?(self)
comparison_object.instance_of?(self.class) && comparison_object.uri == uri && !comparison_object.new_record?
super ||
comparison_object.instance_of?(self.class) &&
id.present? &&
comparison_object.uri == uri
end

def ldp_source
Expand Down

0 comments on commit 07c5cfd

Please sign in to comment.