correct logic for tracking incoming links

This commit is contained in:
Sam 2013-11-11 10:53:01 +11:00
parent d1d661f6e1
commit 0ceeeedf80
1 changed files with 3 additions and 2 deletions

View File

@ -52,8 +52,9 @@ class IncomingLink < ActiveRecord::Base
begin
# TODO achieve same thing with no exception
params = Rails.application.routes.recognize_path(parsed.path)
self.topic_id = params[:topic_id]
self.post_number = params[:post_number]
if self.topic_id = params[:topic_id]
self.post_number = params[:post_number] || 1
end
rescue ActionController::RoutingError
# If we can't route to the url, that's OK. Don't save those two fields.
end