How to specify json format for Sinatra route with named parameter?

How do I add ".json" to a Sinatra route which includes a named parameter such as get '/view/:name' ?

I thought get '/view/:name.json' might work but I get an "Unable to access path /view/name.json" exception.


This code works perfectly:

get '/hello/:name.json' do
  "Hello #{params[:name]}"

=> /hello/samy.json outputs "Hello samy"

Please show the complete stack trace of your exception.


Need Your Help

Advantages/Disadvantages of AIR vs Flex/Web

apache-flex air

I'm tasked with writing an application for placing and connecting objects (sort of like a room planner where you can place furniture). I've made a demo using Flash Builder 4 and built it for AIR as a

Gitolite One User - Many Keys - Different usernames

git authentication ssh gitolite

I have set up gitolite hopefully as per the instructions, and everything is working as planned.