Padrino 0.18.7 release

Padrino 0.18.7 is a maintenance release for 0.18.x with 20 fixes: code reloading in development is faster and more dependable, provides: routes stop answering 500 for unusual formats, generated admin pages behave as expected, and several helpers and caches are safer on JRuby and under concurrent requests.

Changes

  • Reloading in development. Boot and reloads take up to about half as long on Ruby 3.1 and newer (#2500). Classes required from folders the reloader skips, such as config/, or defined by gems and reopened by project files, survive a reload instead of raising NameError or NoMethodError (#2572, #2575). Struct and Data classes, classes that alias built-in methods and classes that override to_s are reloaded like any other (#2569, #2556).
  • Routing and formats. provides: :any routes no longer answer 500 for an unknown Accept header or URL extension, and media type strings in provides: work (#2540, #2548). A format that isn't valid UTF-8 no longer raises (#2559). recognize_path handles percent-encoded paths, and Regexp routes with the n flag or a backreference no longer break requests (#2554).
  • Caching. The in-memory cache stores are safe to share between threads (#2544), and page caching looks a page up only under the key the route stores it under (#2565).
  • Helpers. Date and time formats for Padrino's 21 locales load in every app (#2542). number_to_currency and its siblings round a BigDecimal exactly (#2571). truncate and truncate_words keep to the requested length, and object_model_name works without ActiveSupport (#2533, #2530; thanks, @rawsun007).
  • Generators and admin. Generated admin pages for Active Record and Mongoid models answer 404 for a missing record (#2532); Save and Save and continue go where their names say, and number, date and time columns get matching inputs (#2545). The generator warns when falcon or tailwind need a newer Ruby (#2564), and --api --dev projects take padrino-support from the checkout (#2574).
  • JRuby. Template caches and the logger stay consistent when the first requests arrive at once (#2536).

Upgrading from 0.18.6

  1. In your Gemfile, change gem 'padrino', '~> 0.18.6' (or '0.18.6') to gem 'padrino', '~> 0.18.7', then run bundle update padrino (or, if it lists the padrino-* gems, set each to ~> 0.18.7 and update them by name).
  2. Check these, as listed in the changelog:
    • Padrino::Reloader.exclude entries name a folder or a file: an entry that is only the start of a name, such as lib/legacy_, no longer matches lib/legacy_x.rb. List the folder or the file instead.
    • A project class that a gem adds methods to is now reloaded and comes back without those methods until the app restarts: define it in an excluded folder such as config/.
    • provides: :any answers only extensions with a registered MIME type: ?format=text/csv now gets a 404 (or 406 with treat_format_as_accept). Send ?format=csv, or register a type with mime_type.
    • recognize_path returns nil for a path no route matches, instead of raising NoMethodError.
    • The in-memory cache stores are locked, so they can't be used from a trap handler: pass threadsafe: false for one that is.
    • Existing admin pages keep their files. To get the new Save behaviour and inputs, run padrino g admin_page <Model> again and overwrite the page's controller and form, or edit them by hand. Edit the accounts page by hand, since g admin_page replaces its password fields.

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.