Skip to content

Instantly share code, notes, and snippets.

@rsinger
Created February 9, 2010 18:13
Show Gist options
  • Save rsinger/299484 to your computer and use it in GitHub Desktop.
Save rsinger/299484 to your computer and use it in GitHub Desktop.
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