Created
February 9, 2010 18:13
-
-
Save rsinger/299484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/gacs/:id' do | |
headers['Cache-Control'] = 'public, max-age=43200' | |
area = GeographicArea.first(:code=>params[:id]) | |
halt 404, "Not found" unless area | |
if area.superceded_by | |
replacement = GeographicArea.get(area.superceded_by) | |
redirect "http://purl.org/NET/marccodes/gacs/#{replacement.code}" | |
end | |
@title = area.pref_label | |
@code = area.to_rdf_object | |
respond_to do | wants | | |
wants.rdf { @code.to_xml() } | |
wants.html { haml :gacs } | |
wants.txt {@code.to_ntriples() } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment