From 0ceeeedf80457853681a3e6c7957ca54ab7920a8 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 11 Nov 2013 10:53:01 +1100 Subject: [PATCH] correct logic for tracking incoming links --- app/models/incoming_link.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/incoming_link.rb b/app/models/incoming_link.rb index 0ca8d4acc87..8652daef3d0 100644 --- a/app/models/incoming_link.rb +++ b/app/models/incoming_link.rb @@ -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