Padrino 0.18.5 release

Padrino 0.18.5 is a routing release for 0.18.x: url generation and request routing are faster, most of all in apps with many routes, and the routing methods no longer change the options hashes you give them.

Changes

  • Faster routing. A request skips the routes whose path can't match its first characters. A StopIteration raised while a route runs (in its block, filters or conditions) now reaches your error handlers instead of ending in a 404, and an earlier route for another verb that matches the path no longer fails the request (#2504).
  • Faster url. url looks routes up by name and expands each path once (#2502).
  • Options hashes left unchanged. controller, before, after, parent and url work on a copy of the options hash (and except: or parent: list) they're given. A hash shared by several controller calls applies to each of them, an except: shared by several filters skips the same routes in each, a hash passed to several url calls keeps its fragment:, and frozen hashes no longer raise FrozenError (#2512).

Upgrading from 0.18.4

  1. In your Gemfile, change gem 'padrino', '~> 0.18.4' (or '0.18.4') to gem 'padrino', '~> 0.18.5', then run bundle update padrino (or, if it lists the padrino-* gems, set each to ~> 0.18.5 and update them by name).
  2. Check these, as listed in the changelog:
    • A hash passed to controller or a filter and then to a route now reaches the route whole. A conditions:, use_format: or except: key in it raises when the app is defined (NoMethodError: undefined method 'conditions', 'use_format' or 'except'), and a map: key becomes the route's own path, so get(:one, opts) with opts = { map: '/area' } now answers at /area instead of /area/one. Give the route its own hash.
    • Default values given to controller (such as lang: :de) are read when the controller is defined; changing that hash afterwards no longer changes the urls its routes generate.
    • A StopIteration raised in a route now gives a 500, or your error handler's response, instead of a 404.

Nothing else changes: Ruby 2.7.8 or later, Sinatra 4 and Rack 3 are still required.

comments powered by Disqus

Type to search the guides.