Sinatra v1.2.0 Release Notes

Release Date: 2011-03-03 // about 13 years ago
    • Added slim rendering method for rendering Slim templates. (Steve Hodgkiss)

    • The markaby rendering method now allows passing a block, making inline usage possible. Requires Tilt 1.2 or newer. (Konstantin Haase)

    • All render methods now take a :layout_engine option, allowing to use a layout in a different template language. Even more useful than using this directly (erb :index, :layout_engine => :haml) is setting this globally for a template engine that otherwise does not support layouts, like Markdown or Textile (set :markdown, :layout_engine => :erb). (Konstantin Haase)

    • Before and after filters now support conditions, both with and without patterns (before '/api/*', :agent => /Songbird/). (Konstantin Haase)

    • Added a url helper method which constructs absolute URLs. Copes with reverse proxies and Rack handlers correctly. Aliased to to, so you can write redirect to('/foo'). (Konstantin Haase)

    • If running on 1.9, patterns for routes and filters now support named captures: get(%r{/hi/(?<name>[^/?#]+)}) { "Hi #{params['name']}" }. (Steve Price)

    • All rendering methods now take a :scope option, which renders them in another context. Note that helpers and instance variables will be unavailable if you use this feature. (Paul Walker)

    • The behavior of redirect can now be configured with absolute_redirects and prefixed_redirects. (Konstantin Haase)

    • send_file now allows overriding the Last-Modified header, which defaults to the file's mtime, by passing a :last_modified option. (Konstantin Haase)

    • You can use your own template lookup method by defining find_template. This allows, among other things, using more than one views folder. (Konstantin Haase)

    • Largely improved documentation. (burningTyger, Vasily Polovnyov, Gabriel Andretta, Konstantin Haase)

    • Improved error handling. (cactus, Konstantin Haase)

    • Skip missing template engines in tests correctly. (cactus)

    • Sinatra now ships with a Gemfile for development dependencies, since it eases supporting different platforms, like JRuby. (Konstantin Haase)