aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-09 21:45:08 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-09 21:45:08 +0000
commit96e7186ce2d2872f96c699b9b15957238f152edc (patch)
tree5b16fb5a0c9b43907c4ced86fdacf444a53bfc9b
parent7b107718d666ae4f23f9f41f4d76f32a0c741ff3 (diff)
Old feed URLs should continue to work
-rw-r--r--app/controllers/track_controller.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/track_controller.rb b/app/controllers/track_controller.rb
index e06701a5f..e39a0489d 100644
--- a/app/controllers/track_controller.rb
+++ b/app/controllers/track_controller.rb
@@ -46,7 +46,14 @@ class TrackController < ApplicationController
# Track all updates to a particular public body
def track_public_body
- @public_body = PublicBody.find_by_url_name(params[:url_name])
+ @public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
+ raise ActiveRecord::RecordNotFound.new("None found") if @public_body.nil?
+ # If found by historic name, or alternate locale name, redirect to new name
+ if @public_body.url_name != params[:url_name]
+ redirect_to track_public_body_url(:url_name => @public_body.url_name, :feed => params[:feed])
+ return
+ end
+
@track_thing = TrackThing.create_track_for_public_body(@public_body)
return atom_feed_internal if params[:feed] == 'feed'