25 Apr '13, 7am

sinatra/json しようとして よんでるけど無慈悲な "NameError: uninitialized constant MultiJson" に阻まれる。

This extension is part of the Sinatra::Contrib project. Run gem install sinatra-contrib to have it available. Sinatra::JSON Sinatra::JSON adds a helper method, called json , for (obviously) json generation. Usage Classic Application In a classic application simply require the helper, and start using it: require "sinatra" require "sinatra/json" # define a route that uses the helper get '/' do json :foo => 'bar' end # The rest of your classic application code goes here... Modular Application In a modular application you need to require the helper, and then tell the application you will use it: require "sinatra/base" require "sinatra/json" class MyApp < Sinatra::Base helpers Sinatra::JSON # define a route that uses the helper get '/' do json :foo => 'bar' end # The rest of your modular application code goes here... end Encoders By default it will try to call to_json on the ob...

Full article: http://www.sinatrarb.com/contrib/json.html

Tweets

@__gfx__ はい、いわゆるSinatraのClassic style(トップレベルでge...

sinatrarb.com 25 Apr '13, 7am

This extension is part of the Sinatra::Contrib project. Run gem install sinatra-contrib to have it available. Sinatra::Rel...

Latest: Build Podcast 040 Sinatra

tech65.org 28 Apr '13, 12am

is a simple domain-specific language that is minimalistic. In this episode, we will explore the basics of Sinatra such as ...