Active Job • Framework for background processing using Resque, Delayed Job, Sidekiq, etc. • Switch between background runners without having to rewrite jobs • If no adapter is specified, jobs run immediately
Enqueue Job • Enqueue with or without a time: # Run next ProcessVideo.perform_later(@video) # Run tomorrow ProcessVideo.set(wait: 1.day) .perform_later(@video)
Error Handling • Catch exceptions with a block: class ProcessVideoJob < ActiveJob::Base ... rescue_from(Exception) do |e| # do something with exception end end
Global ID • A unique identifier for a model instance • ActiveJob uses Global ID to automatically serialize and deserialize objects irb> video.to_global_id.to_s => "gid://appname/Video/1"
Adequate Record • Optimizations to Active Record that make the find, find_by_*, and find_by methods up to 2x faster • Caches the static parts of the SQL query User.find(1) # Caches the static part: # SELECT * FROM users WHERE id = ? User.find(2) # Uses the cache, executes faster
Web Console • Debugging tool for your Rails app • Automatically opens a Rails console on exceptions • Can also be opened with the console view helper <%= console %>
Other Changes • Previously deprecated functionality has been removed • Check for deprecation warnings before updating • The respond_with / class-level respond_to methods have been moved to the responders gem • The default host for rails server is now localhost instead of 0.0.0.0 • If you dev in a virtual machine this will bite you
Other Changes • The default log level for production is now :debug, just like development and test • The HTML sanitizer has been replaced with a new version. • Some sanitized output might change • Foreign key support (finally) • And more…