Skip to content

verify_url in pid.rb using old ORM mapping #5

@briri

Description

@briri

The verify_url method of the pid.rb object was not updated to reflect changes made to the ORM mappings between pid.rb and invalid_url.rb. The relationship of the foreign key between the two entities was changed. The old structure had the invalid_url on pid as a foreign key relationship. This was updated so that the invalid_url now has a pid_id foreign key.

The offending code is:

if res.code.to_i >= 300 and res.code.to_i != 302
  self.invalid_url_report = InvalidUrlReport.new(:http_code => res.code.to_i, :last_checked => Time.now)
else
  self.invalid_url_report = nil
end

It should probably be updated to:

if res.code.to_i >= 300 and res.code.to_i != 302
  iur = InvalidUrlReport.new(:pid => self, :http_code => res.code.to_i, :last_checked => Time.now)
  iur.save
else
  iur = InvalidUrlReport.findByPid(:pid => self)
  iur.destroy unless iur.nil?
end

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions