Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
get'/ view /:name'などの名前付きパラメーターを含むSinatraルートに「.json」を追加するにはどうすればよい ですか?
get'/view/:name.json'は機能するかもしれないと思いましたが、「パス/view/name.jsonにアクセスできません」という例外が発生します。
このコードは完全に機能します:
get '/hello/:name.json' do "Hello #{params[:name]}" end => /hello/samy.json outputs "Hello samy"
例外の完全なスタック トレースを表示してください。
また、
https://github.com/sinatra/sinatra/issues/490