Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify_url in pid.rb using old ORM mapping #5

Open
briri opened this issue Jun 16, 2015 · 0 comments
Open

verify_url in pid.rb using old ORM mapping #5

briri opened this issue Jun 16, 2015 · 0 comments
Assignees

Comments

@briri
Copy link
Member

briri commented Jun 16, 2015

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants