jump to navigation

Sinatra utf-8 Content-Type before filter April 22, 2009

Posted by John Dewey in Code, Example, Sinatra.
add a comment

I wanted to learn Sinatra, so I started converting my personal Rails site over to Sinatra. I scrape my Twitterholic rating, and redisplay it on my site. I need the css and html to have a Content-Type of utf-8.

I came up with the following before filter. There is probably a better way to do this, I just wanted my controllers to be less “wet”.

I also use the following to render all css.

Running Sinatra with Phusion Passenger April 19, 2009

Posted by John Dewey in Passenger, Rack, Ruby, Sinatra.
1 comment so far

Here is a config.ru for use with Sinatra. It also includes a logging section for your app. This configuration works on Sinatra (0.9.1.1). Quite a few of the examples out there use the deprecated Sinatra::Application.default_options vs set.

:update:

Updated config.ru with Blake’s suggestions.