aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/public_body_controller.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-06-13 13:13:52 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-06-13 13:13:52 +0100
commit0eb9ef894e8c3353074caf4d39c81830e1ce2dc0 (patch)
tree4dde8a6df4053ff5fd56445da14d19ffdba837c4 /app/controllers/public_body_controller.rb
parent7d98112cc8394b3b9656f9ac5ec6da02f1c08723 (diff)
Make sure the template rendering happens within the scope of
with_locale, so it's rendered using the correct locale. (+ test for this)
Diffstat (limited to 'app/controllers/public_body_controller.rb')
-rw-r--r--app/controllers/public_body_controller.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb
index cf64046ea..688cfab3d 100644
--- a/app/controllers/public_body_controller.rb
+++ b/app/controllers/public_body_controller.rb
@@ -21,10 +21,12 @@ class PublicBodyController < ApplicationController
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise "None found" if @public_body.nil? # XXX proper 404
- # If found by historic name, redirect to new name
- redirect_to show_public_body_url(:url_name => @public_body.url_name) if
- @public_body.url_name != params[:url_name]
-
+ # If found by historic name, or alternate locale name, redirect to new name
+ if @public_body.url_name != params[:url_name]
+ redirect_to show_public_body_url(:url_name => @public_body.url_name)
+ return
+ end
+
set_last_body(@public_body)
top_url = main_url("/")
@@ -51,9 +53,10 @@ class PublicBodyController < ApplicationController
@feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss], :has_json => true } ]
respond_to do |format|
- format.html { @has_json = true }
+ format.html { @has_json = true; render :template => "public_body/show"}
format.json { render :json => @public_body.json_for_api }
end
+
end
end