CINXE.COM

Ruby on Rails 5.0 Release Notes — Ruby on Rails Guides

<!doctype html> <html dir="ltr" lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Ruby on Rails 5.0 Release Notes — Ruby on Rails Guides</title> <link rel="stylesheet" type="text/css" href="stylesheets/style-071e355820fc155a5c40ef8a1c0c4971.css" data-turbo-track="reload"> <link rel="stylesheet" type="text/css" href="stylesheets/print-a87ee66d50ce96bb83ac082f1249fe3e.css" media="print"> <link rel="stylesheet" type="text/css" href="stylesheets/highlight-a0d2133dd0073968b2d33b1f1360a2a3.css" data-turbo-track="reload"> <link rel="icon" href="images/favicon.ico" sizes="any"> <link rel="apple-touch-icon" href="images/icon.png"> <script src="javascripts/@hotwired--turbo-764f59c7edbeb902a9068c0340dd274e.js" data-turbo-track="reload"></script> <script src="javascripts/clipboard-8b7aed6f069f0cf58eeae353cd2f898b.js" data-turbo-track="reload"></script> <script src="javascripts/guides-897790ae3777ddd81bd4953f7ec99835.js" data-turbo-track="reload"></script> <meta property="og:title" content="Ruby on Rails 5.0 Release Notes — Ruby on Rails Guides" /> <meta name="description" content="Ruby on Rails 5.0 Release NotesHighlights in Rails 5.0: Action Cable Rails API Active Record Attributes API Test Runner Exclusive use of rails CLI over Rake Sprockets 3 Turbolinks 5 Ruby 2.2.2+ required These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the changelogs or check out the list of commits in the main Rails repository on GitHub." /> <meta property="og:description" content="Ruby on Rails 5.0 Release NotesHighlights in Rails 5.0: Action Cable Rails API Active Record Attributes API Test Runner Exclusive use of rails CLI over Rake Sprockets 3 Turbolinks 5 Ruby 2.2.2+ required These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the changelogs or check out the list of commits in the main Rails repository on GitHub." /> <meta property="og:locale" content="en_US" /> <meta property="og:site_name" content="Ruby on Rails Guides" /> <meta property="og:image" content="https://avatars.githubusercontent.com/u/4223" /> <meta property="og:type" content="website" /> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@100..900&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Heebo:wght@100..900&family=Noto+Sans+Arabic:wght@100..900&display=swap" rel="stylesheet"> <meta name="theme-color" content="#C81418"> </head> <body dir="ltr" class="guide no-js"> <script> document.body.classList.remove('no-js') </script> <a id="main-skip-link" href="#main" class="skip-link" data-turbo="false"> Skip to main content </a> <div id="mobile-navigation-bar"> <div class="wrapper"> <strong class="more-info-label">More at <a href="https://rubyonrails.org/">rubyonrails.org:</a> </strong> <button type="button" class="js-only red-button more-info-button" id="more-info" aria-controls="more-info-links" aria-expanded="false"> More Ruby on Rails </button> <ul id="more-info-links" class="more-info-links hidden"> <li class="more-info"><a href="https://rubyonrails.org/blog">Blog</a></li> <li class="more-info"><a href="https://guides.rubyonrails.org/">Guides</a></li> <li class="more-info"><a href="https://api.rubyonrails.org/">API</a></li> <li class="more-info"><a href="https://discuss.rubyonrails.org/">Forum</a></li> <li class="more-info"><a href="https://github.com/rails/rails">Contribute on GitHub</a></li> </ul> </div> </div> <header id="page-header"> <div class="wrapper clearfix"> <nav id="feature-nav"> <div class="header-logo"> <a href="index.html" title="Guides home for v8.0.0 Guides">Guides</a> <span id="version-switcher" class="js-only"> <label for="version-switcher-select">Version: <span class="visibly-hidden">pick from the list to go to that Rails version's guides</span></label> <select id="version-switcher-select" class="guides-version"> <option value="https://edgeguides.rubyonrails.org/">Edge</option> <option value="https://guides.rubyonrails.org/v8.0/" selected>8.0</option> <option value="https://guides.rubyonrails.org/v7.2/">7.2</option> <option value="https://guides.rubyonrails.org/v7.1/">7.1</option> <option value="https://guides.rubyonrails.org/v7.0/">7.0</option> <option value="https://guides.rubyonrails.org/v6.1/">6.1</option> <option value="https://guides.rubyonrails.org/v6.0/">6.0</option> <option value="https://guides.rubyonrails.org/v5.2/">5.2</option> <option value="https://guides.rubyonrails.org/v5.1/">5.1</option> <option value="https://guides.rubyonrails.org/v5.0/">5.0</option> <option value="https://guides.rubyonrails.org/v4.2/">4.2</option> <option value="https://guides.rubyonrails.org/v4.1/">4.1</option> <option value="https://guides.rubyonrails.org/v4.0/">4.0</option> <option value="https://guides.rubyonrails.org/v3.2/">3.2</option> <option value="https://guides.rubyonrails.org/v3.1/">3.1</option> <option value="https://guides.rubyonrails.org/v3.0/">3.0</option> <option value="https://guides.rubyonrails.org/v2.3/">2.3</option> </select> </span> </div> <ul class="nav"> <li><a class="nav-item" id="home_nav" href="https://rubyonrails.org/">Home</a></li> <li class="guides-index guides-index-large"> <a href="index.html" id="guides-menu-button" data-aria-controls="guides" data-aria-expanded="false" class="guides-index-item nav-item">Guides Index</a> <div id="guides" class="clearfix" style="display: none;"> <hr /> <dl class="guides-section-container"> <div class="guides-section"> <dt>Start Here</dt> <dd><a href="getting_started.html">Getting Started with Rails</a></dd> </div> <div class="guides-section"> <dt>Models</dt> <dd><a href="active_record_basics.html">Active Record Basics</a></dd> <dd><a href="active_record_migrations.html">Active Record Migrations</a></dd> <dd><a href="active_record_validations.html">Active Record Validations</a></dd> <dd><a href="active_record_callbacks.html">Active Record Callbacks</a></dd> <dd><a href="association_basics.html">Active Record Associations</a></dd> <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd> <dd><a href="active_model_basics.html">Active Model Basics</a></dd> </div> <div class="guides-section"> <dt>Views</dt> <dd><a href="action_view_overview.html">Action View Overview</a></dd> <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd> <dd><a href="action_view_helpers.html">Action View Helpers</a></dd> <dd><a href="form_helpers.html">Action View Form Helpers</a></dd> </div> <div class="guides-section"> <dt>Controllers</dt> <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd> <dd><a href="routing.html">Rails Routing from the Outside In</a></dd> </div> <div class="guides-section"> <dt>Other Components</dt> <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd> <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd> <dd><a href="action_mailbox_basics.html">Action Mailbox Basics</a></dd> <dd><a href="action_text_overview.html">Action Text Overview</a></dd> <dd><a href="active_job_basics.html">Active Job Basics</a></dd> <dd><a href="active_storage_overview.html">Active Storage Overview</a></dd> <dd><a href="action_cable_overview.html">Action Cable Overview</a></dd> </div> <div class="guides-section"> <dt>Digging Deeper</dt> <dd><a href="i18n.html">Rails Internationalization (I18n) API</a></dd> <dd><a href="testing.html">Testing Rails Applications</a></dd> <dd><a href="security.html">Securing Rails Applications</a></dd> <dd><a href="error_reporting.html">Error Reporting in Rails Applications</a></dd> <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd> <dd><a href="configuring.html">Configuring Rails Applications</a></dd> <dd><a href="command_line.html">The Rails Command Line</a></dd> <dd><a href="asset_pipeline.html">The Asset Pipeline</a></dd> <dd><a href="working_with_javascript_in_rails.html">Working with JavaScript in Rails</a></dd> <dd><a href="autoloading_and_reloading_constants.html">Autoloading and Reloading</a></dd> <dd><a href="caching_with_rails.html">Caching with Rails: An Overview</a></dd> <dd><a href="api_app.html">Using Rails for API-only Applications</a></dd> <dd><a href="tuning_performance_for_deployment.html">Tuning Performance for Deployment</a></dd> </div> <div class="guides-section"> <dt>Advanced Active Record</dt> <dd><a href="active_record_multiple_databases.html">Multiple Databases</a></dd> <dd><a href="active_record_composite_primary_keys.html">Composite Primary Keys</a></dd> </div> <div class="guides-section"> <dt>Extending Rails</dt> <dd><a href="rails_on_rack.html">Rails on Rack</a></dd> <dd><a href="generators.html">Creating and Customizing Rails Generators &amp; Templates</a></dd> </div> <div class="guides-section"> <dt>Contributing</dt> <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd> <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd> <dd><a href="ruby_on_rails_guides_guidelines.html">Guides Guidelines</a></dd> <dd><a href="development_dependencies_install.html">Installing Rails Core Development Dependencies</a></dd> </div> <div class="guides-section"> <dt>Policies</dt> <dd><a href="maintenance_policy.html">Maintenance Policy</a></dd> </div> <div class="guides-section"> <dt>Release Notes</dt> <dd><a href="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</a></dd> <dd><a href="7_2_release_notes.html">Version 7.2 - August 2024</a></dd> <dd><a href="7_1_release_notes.html">Version 7.1 - October 2023</a></dd> <dd><a href="7_0_release_notes.html">Version 7.0 - December 2021</a></dd> <dd><a href="6_1_release_notes.html">Version 6.1 - December 2020</a></dd> <dd><a href="6_0_release_notes.html">Version 6.0 - August 2019</a></dd> <dd><a href="5_2_release_notes.html">Version 5.2 - April 2018</a></dd> <dd><a href="5_1_release_notes.html">Version 5.1 - April 2017</a></dd> <dd><a href="5_0_release_notes.html">Version 5.0 - June 2016</a></dd> <dd><a href="4_2_release_notes.html">Version 4.2 - December 2014</a></dd> <dd><a href="4_1_release_notes.html">Version 4.1 - April 2014</a></dd> <dd><a href="4_0_release_notes.html">Version 4.0 - June 2013</a></dd> <dd><a href="3_2_release_notes.html">Version 3.2 - January 2012</a></dd> <dd><a href="3_1_release_notes.html">Version 3.1 - August 2011</a></dd> <dd><a href="3_0_release_notes.html">Version 3.0 - August 2010</a></dd> <dd><a href="2_3_release_notes.html">Version 2.3 - March 2009</a></dd> <dd><a href="2_2_release_notes.html">Version 2.2 - November 2008</a></dd> </div> </dl> </div> </li> <li><a class="nav-item" href="contributing_to_ruby_on_rails.html">Contribute</a></li> <li class="guides-index guides-index-small js-only"> <label for="guides-selector"> Navigate to a guide: </label> <select id="guides-selector" class="guides-index-item nav-item"> <option value="index.html">Guides Index</option> <optgroup label="Start Here"> <option value="getting_started.html">Getting Started with Rails</option> </optgroup> <optgroup label="Models"> <option value="active_record_basics.html">Active Record Basics</option> <option value="active_record_migrations.html">Active Record Migrations</option> <option value="active_record_validations.html">Active Record Validations</option> <option value="active_record_callbacks.html">Active Record Callbacks</option> <option value="association_basics.html">Active Record Associations</option> <option value="active_record_querying.html">Active Record Query Interface</option> <option value="active_model_basics.html">Active Model Basics</option> </optgroup> <optgroup label="Views"> <option value="action_view_overview.html">Action View Overview</option> <option value="layouts_and_rendering.html">Layouts and Rendering in Rails</option> <option value="action_view_helpers.html">Action View Helpers</option> <option value="form_helpers.html">Action View Form Helpers</option> </optgroup> <optgroup label="Controllers"> <option value="action_controller_overview.html">Action Controller Overview</option> <option value="routing.html">Rails Routing from the Outside In</option> </optgroup> <optgroup label="Other Components"> <option value="active_support_core_extensions.html">Active Support Core Extensions</option> <option value="action_mailer_basics.html">Action Mailer Basics</option> <option value="action_mailbox_basics.html">Action Mailbox Basics</option> <option value="action_text_overview.html">Action Text Overview</option> <option value="active_job_basics.html">Active Job Basics</option> <option value="active_storage_overview.html">Active Storage Overview</option> <option value="action_cable_overview.html">Action Cable Overview</option> </optgroup> <optgroup label="Digging Deeper"> <option value="i18n.html">Rails Internationalization (I18n) API</option> <option value="testing.html">Testing Rails Applications</option> <option value="security.html">Securing Rails Applications</option> <option value="error_reporting.html">Error Reporting in Rails Applications</option> <option value="debugging_rails_applications.html">Debugging Rails Applications</option> <option value="configuring.html">Configuring Rails Applications</option> <option value="command_line.html">The Rails Command Line</option> <option value="asset_pipeline.html">The Asset Pipeline</option> <option value="working_with_javascript_in_rails.html">Working with JavaScript in Rails</option> <option value="autoloading_and_reloading_constants.html">Autoloading and Reloading</option> <option value="caching_with_rails.html">Caching with Rails: An Overview</option> <option value="api_app.html">Using Rails for API-only Applications</option> <option value="tuning_performance_for_deployment.html">Tuning Performance for Deployment</option> </optgroup> <optgroup label="Advanced Active Record"> <option value="active_record_multiple_databases.html">Multiple Databases</option> <option value="active_record_composite_primary_keys.html">Composite Primary Keys</option> </optgroup> <optgroup label="Extending Rails"> <option value="rails_on_rack.html">Rails on Rack</option> <option value="generators.html">Creating and Customizing Rails Generators &amp; Templates</option> </optgroup> <optgroup label="Contributing"> <option value="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</option> <option value="api_documentation_guidelines.html">API Documentation Guidelines</option> <option value="ruby_on_rails_guides_guidelines.html">Guides Guidelines</option> <option value="development_dependencies_install.html">Installing Rails Core Development Dependencies</option> </optgroup> <optgroup label="Policies"> <option value="maintenance_policy.html">Maintenance Policy</option> </optgroup> <optgroup label="Release Notes"> <option value="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</option> <option value="7_2_release_notes.html">Version 7.2 - August 2024</option> <option value="7_1_release_notes.html">Version 7.1 - October 2023</option> <option value="7_0_release_notes.html">Version 7.0 - December 2021</option> <option value="6_1_release_notes.html">Version 6.1 - December 2020</option> <option value="6_0_release_notes.html">Version 6.0 - August 2019</option> <option value="5_2_release_notes.html">Version 5.2 - April 2018</option> <option value="5_1_release_notes.html">Version 5.1 - April 2017</option> <option value="5_0_release_notes.html">Version 5.0 - June 2016</option> <option value="4_2_release_notes.html">Version 4.2 - December 2014</option> <option value="4_1_release_notes.html">Version 4.1 - April 2014</option> <option value="4_0_release_notes.html">Version 4.0 - June 2013</option> <option value="3_2_release_notes.html">Version 3.2 - January 2012</option> <option value="3_1_release_notes.html">Version 3.1 - August 2011</option> <option value="3_0_release_notes.html">Version 3.0 - August 2010</option> <option value="2_3_release_notes.html">Version 2.3 - March 2009</option> <option value="2_2_release_notes.html">Version 2.2 - November 2008</option> </optgroup> </select> </li> </ul> </nav> </div> </header> <hr class="hide" /> <main id="main"> <article> <header id="feature"> <div class="wrapper"> <h1>Ruby on Rails 5.0 Release Notes</h1><p>Highlights in Rails 5.0:</p> <ul> <li>Action Cable</li> <li>Rails API</li> <li>Active Record Attributes API</li> <li>Test Runner</li> <li>Exclusive use of <code>rails</code> CLI over Rake</li> <li>Sprockets 3</li> <li>Turbolinks 5</li> <li>Ruby 2.2.2+ required</li> </ul> <p>These release notes cover only the major changes. To learn about various bug fixes and changes, please refer to the changelogs or check out the <a href="https://github.com/rails/rails/commits/5-0-stable">list of commits</a> in the main Rails repository on GitHub.</p> <nav id="column-side" aria-label="Chapter" class="guide-index" data-turbo="false"> <a id="chapter-nav-skip-link" href="#article-body" class="skip-link"> Skip to article body </a> <h2 class="chapter"> <picture aria-hidden="true"> <!-- Using the `source` HTML tag to set the dark theme image --> <source srcset="images/icon_book-close-bookmark-1-wht.svg" media="(prefers-color-scheme: dark)" /> <img src="images/icon_book-close-bookmark-1.svg" alt="Chapter Icon" /> </picture> Chapters </h2> <ol class="chapters"> <li><a href="#upgrading-to-rails-5-0">Upgrading to Rails 5.0</a></li> <li><a href="#major-features">Major Features</a> <ul> <li><a href="#action-cable">Action Cable</a></li> <li><a href="#api-applications">API Applications</a></li> <li><a href="#active-record-attributes-api">Active Record attributes API</a></li> <li><a href="#test-runner">Test Runner</a></li> </ul></li> <li><a href="#railties">Railties</a> <ul> <li><a href="#railties-removals">Removals</a></li> <li><a href="#railties-deprecations">Deprecations</a></li> <li><a href="#railties-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#action-pack">Action Pack</a> <ul> <li><a href="#action-pack-removals">Removals</a></li> <li><a href="#action-pack-deprecations">Deprecations</a></li> <li><a href="#action-pack-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#action-view">Action View</a> <ul> <li><a href="#action-view-removals">Removals</a></li> <li><a href="#action-view-notable-changes">Notable Changes</a></li> </ul></li> <li><a href="#action-mailer">Action Mailer</a> <ul> <li><a href="#action-mailer-removals">Removals</a></li> <li><a href="#action-mailer-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#active-record">Active Record</a> <ul> <li><a href="#active-record-removals">Removals</a></li> <li><a href="#active-record-deprecations">Deprecations</a></li> <li><a href="#active-record-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#active-model">Active Model</a> <ul> <li><a href="#active-model-removals">Removals</a></li> <li><a href="#active-model-deprecations">Deprecations</a></li> <li><a href="#active-model-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#active-job">Active Job</a> <ul> <li><a href="#active-job-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#active-support">Active Support</a> <ul> <li><a href="#removals">Removals</a></li> <li><a href="#deprecations">Deprecations</a></li> <li><a href="#active-support-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#credits">Credits</a></li> </ol> </nav> </div> </header> <div class="wrapper"> <div id="column-main"> <section id="article-body"> <h2 id="upgrading-to-rails-5-0"><a class="anchorlink" href="#upgrading-to-rails-5-0" data-turbo="false"><span>1</span> Upgrading to Rails 5.0</a></h2><p>If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 4.2 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 5.0. A list of things to watch out for when upgrading is available in the <a href="upgrading_ruby_on_rails.html#upgrading-from-rails-4-2-to-rails-5-0">Upgrading Ruby on Rails</a> guide.</p><h2 id="major-features"><a class="anchorlink" href="#major-features" data-turbo="false"><span>2</span> Major Features</a></h2><h3 id="action-cable"><a class="anchorlink" href="#action-cable" data-turbo="false"><span>2.1</span> Action Cable</a></h3><p>Action Cable is a new framework in Rails 5. It seamlessly integrates <a href="https://en.wikipedia.org/wiki/WebSocket">WebSockets</a> with the rest of your Rails application.</p><p>Action Cable allows for real-time features to be written in Ruby in the same style and form as the rest of your Rails application, while still being performant and scalable. It's a full-stack offering that provides both a client-side JavaScript framework and a server-side Ruby framework. You have access to your full domain model written with Active Record or your ORM of choice.</p><p>See the <a href="action_cable_overview.html">Action Cable Overview</a> guide for more information.</p><h3 id="api-applications"><a class="anchorlink" href="#api-applications" data-turbo="false"><span>2.2</span> API Applications</a></h3><p>Rails can now be used to create slimmed down API only applications. This is useful for creating and serving APIs similar to <a href="https://developer.x.com">X</a> or <a href="https://developer.github.com">GitHub</a> API, that can be used to serve public-facing, as well as, for custom applications.</p><p>You can generate a new api Rails app using:</p><div class="interstitial code"> <pre><code class="highlight console"><span class="gp">$</span><span class="w"> </span><span class="nb">rails </span>new my_api <span class="nt">--api</span> </code></pre> <button class="clipboard-button" data-clipboard-text="rails new my_api --api ">Copy</button> </div> <p>This will do three main things:</p> <ul> <li>Configure your application to start with a more limited set of middleware than normal. Specifically, it will not include any middleware primarily useful for browser applications (like cookies support) by default.</li> <li>Make <code>ApplicationController</code> inherit from <code>ActionController::API</code> instead of <code>ActionController::Base</code>. As with middleware, this will leave out any Action Controller modules that provide functionalities primarily used by browser applications.</li> <li>Configure the generators to skip generating views, helpers, and assets when you generate a new resource.</li> </ul> <p>The application provides a base for APIs, that can then be <a href="api_app.html">configured to pull in functionality</a> as suitable for the application's needs.</p><p>See the <a href="api_app.html">Using Rails for API-only Applications</a> guide for more information.</p><h3 id="active-record-attributes-api"><a class="anchorlink" href="#active-record-attributes-api" data-turbo="false"><span>2.3</span> Active Record attributes API</a></h3><p>Defines an attribute with a type on a model. It will override the type of existing attributes if needed. This allows control over how values are converted to and from SQL when assigned to a model. It also changes the behavior of values passed to <code>ActiveRecord::Base.where</code>, which let's use our domain objects across much of Active Record, without having to rely on implementation details or monkey patching.</p><p>Some things that you can achieve with this:</p> <ul> <li>The type detected by Active Record can be overridden.</li> <li>A default can also be provided.</li> <li>Attributes do not need to be backed by a database column.</li> </ul> <div class="interstitial code"> <pre><code class="highlight ruby"><span class="c1"># db/schema.rb</span> <span class="n">create_table</span> <span class="ss">:store_listings</span><span class="p">,</span> <span class="ss">force: </span><span class="kp">true</span> <span class="k">do</span> <span class="o">|</span><span class="n">t</span><span class="o">|</span> <span class="n">t</span><span class="p">.</span><span class="nf">decimal</span> <span class="ss">:price_in_cents</span> <span class="n">t</span><span class="p">.</span><span class="nf">string</span> <span class="ss">:my_string</span><span class="p">,</span> <span class="ss">default: </span><span class="s2">"original default"</span> <span class="k">end</span> </code></pre> <button class="clipboard-button" data-clipboard-text="create_table :store_listings, force: true do |t| t.decimal :price_in_cents t.string :my_string, default: &quot;original default&quot; end ">Copy</button> </div> <div class="interstitial code"> <pre><code class="highlight ruby"><span class="c1"># app/models/store_listing.rb</span> <span class="k">class</span> <span class="nc">StoreListing</span> <span class="o">&lt;</span> <span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span> <span class="k">end</span> </code></pre> <button class="clipboard-button" data-clipboard-text="class StoreListing < ActiveRecord::Base end ">Copy</button> </div> <div class="interstitial code"> <pre><code class="highlight ruby"><span class="n">store_listing</span> <span class="o">=</span> <span class="no">StoreListing</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">price_in_cents: </span><span class="s1">'10.1'</span><span class="p">)</span> <span class="c1"># before</span> <span class="n">store_listing</span><span class="p">.</span><span class="nf">price_in_cents</span> <span class="c1"># =&gt; BigDecimal.new(10.1)</span> <span class="no">StoreListing</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">my_string</span> <span class="c1"># =&gt; "original default"</span> <span class="k">class</span> <span class="nc">StoreListing</span> <span class="o">&lt;</span> <span class="no">ActiveRecord</span><span class="o">::</span><span class="no">Base</span> <span class="n">attribute</span> <span class="ss">:price_in_cents</span><span class="p">,</span> <span class="ss">:integer</span> <span class="c1"># custom type</span> <span class="n">attribute</span> <span class="ss">:my_string</span><span class="p">,</span> <span class="ss">:string</span><span class="p">,</span> <span class="ss">default: </span><span class="s2">"new default"</span> <span class="c1"># default value</span> <span class="n">attribute</span> <span class="ss">:my_default_proc</span><span class="p">,</span> <span class="ss">:datetime</span><span class="p">,</span> <span class="ss">default: </span><span class="o">-&gt;</span> <span class="p">{</span> <span class="no">Time</span><span class="p">.</span><span class="nf">now</span> <span class="p">}</span> <span class="c1"># default value</span> <span class="n">attribute</span> <span class="ss">:field_without_db_column</span><span class="p">,</span> <span class="ss">:integer</span><span class="p">,</span> <span class="ss">array: </span><span class="kp">true</span> <span class="k">end</span> <span class="c1"># after</span> <span class="n">store_listing</span><span class="p">.</span><span class="nf">price_in_cents</span> <span class="c1"># =&gt; 10</span> <span class="no">StoreListing</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">my_string</span> <span class="c1"># =&gt; "new default"</span> <span class="no">StoreListing</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">my_default_proc</span> <span class="c1"># =&gt; 2015-05-30 11:04:48 -0600</span> <span class="n">model</span> <span class="o">=</span> <span class="no">StoreListing</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">field_without_db_column: </span><span class="p">[</span><span class="s2">"1"</span><span class="p">,</span> <span class="s2">"2"</span><span class="p">,</span> <span class="s2">"3"</span><span class="p">])</span> <span class="n">model</span><span class="p">.</span><span class="nf">attributes</span> <span class="c1"># =&gt; {field_without_db_column: [1, 2, 3]}</span> </code></pre> <button class="clipboard-button" data-clipboard-text="store_listing = StoreListing.new(price_in_cents: '10.1') # before store_listing.price_in_cents # => BigDecimal.new(10.1) StoreListing.new.my_string # => &quot;original default&quot; class StoreListing < ActiveRecord::Base attribute :price_in_cents, :integer # custom type attribute :my_string, :string, default: &quot;new default&quot; # default value attribute :my_default_proc, :datetime, default: -> { Time.now } # default value attribute :field_without_db_column, :integer, array: true end # after store_listing.price_in_cents # => 10 StoreListing.new.my_string # => &quot;new default&quot; StoreListing.new.my_default_proc # => 2015-05-30 11:04:48 -0600 model = StoreListing.new(field_without_db_column: [&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]) model.attributes # => {field_without_db_column: [1, 2, 3]} ">Copy</button> </div> <p><strong>Creating Custom Types:</strong></p><p>You can define your own custom types, as long as they respond to the methods defined on the value type. The method <code>deserialize</code> or <code>cast</code> will be called on your type object, with raw input from the database or from your controllers. This is useful, for example, when doing custom conversion, like Money data.</p><p><strong>Querying:</strong></p><p>When <code>ActiveRecord::Base.where</code> is called, it will use the type defined by the model class to convert the value to SQL, calling <code>serialize</code> on your type object.</p><p>This gives the objects ability to specify, how to convert values when performing SQL queries.</p><p><strong>Dirty Tracking:</strong></p><p>The type of an attribute is allowed to change how dirty tracking is performed.</p><p>See its <a href="https://api.rubyonrails.org/v5.0.1/classes/ActiveRecord/Attributes/ClassMethods.html">documentation</a> for a detailed write up.</p><h3 id="test-runner"><a class="anchorlink" href="#test-runner" data-turbo="false"><span>2.4</span> Test Runner</a></h3><p>A new test runner has been introduced to enhance the capabilities of running tests from Rails. To use this test runner simply type <code>bin/rails test</code>.</p><p>Test Runner is inspired by <code>RSpec</code>, <code>minitest-reporters</code>, <code>maxitest</code> and others. It includes some of these notable advancements:</p> <ul> <li>Run a single test using line number of test.</li> <li>Run multiple tests pinpointing to line number of tests.</li> <li>Improved failure messages, which also add ease of re-running failed tests.</li> <li>Fail fast using <code>-f</code> option, to stop tests immediately on occurrence of failure, instead of waiting for the suite to complete.</li> <li>Defer test output until the end of a full test run using the <code>-d</code> option.</li> <li>Complete exception backtrace output using <code>-b</code> option.</li> <li>Integration with minitest to allow options like <code>-s</code> for test seed data, <code>-n</code> for running specific test by name, <code>-v</code> for better verbose output and so forth.</li> <li>Colored test output.</li> </ul> <h2 id="railties"><a class="anchorlink" href="#railties" data-turbo="false"><span>3</span> Railties</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/railties/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="railties-removals"><a class="anchorlink" href="#railties-removals" data-turbo="false"><span>3.1</span> Removals</a></h3> <ul> <li><p> Removed debugger support, use byebug instead. <code>debugger</code> is not supported by Ruby 2.2. (<a href="https://github.com/rails/rails/commit/93559da4826546d07014f8cfa399b64b4a143127">commit</a>)</p></li> <li><p> Removed deprecated <code>test:all</code> and <code>test:all:db</code> tasks. (<a href="https://github.com/rails/rails/commit/f663132eef0e5d96bf2a58cec9f7c856db20be7c">commit</a>)</p></li> <li><p> Removed deprecated <code>Rails::Rack::LogTailer</code>. (<a href="https://github.com/rails/rails/commit/c564dcb75c191ab3d21cc6f920998b0d6fbca623">commit</a>)</p></li> <li><p> Removed deprecated <code>RAILS_CACHE</code> constant. (<a href="https://github.com/rails/rails/commit/b7f856ce488ef8f6bf4c12bb549f462cb7671c08">commit</a>)</p></li> <li><p> Removed deprecated <code>serve_static_assets</code> configuration. (<a href="https://github.com/rails/rails/commit/463b5d7581ee16bfaddf34ca349b7d1b5878097c">commit</a>)</p></li> <li><p> Removed the documentation tasks <code>doc:app</code>, <code>doc:rails</code>, and <code>doc:guides</code>. (<a href="https://github.com/rails/rails/commit/cd7cc5254b090ccbb84dcee4408a5acede25ef2a">commit</a>)</p></li> <li><p> Removed <code>Rack::ContentLength</code> middleware from the default stack. (<a href="https://github.com/rails/rails/commit/56903585a099ab67a7acfaaef0a02db8fe80c450">Commit</a>)</p></li> </ul> <h3 id="railties-deprecations"><a class="anchorlink" href="#railties-deprecations" data-turbo="false"><span>3.2</span> Deprecations</a></h3> <ul> <li><p> Deprecated <code>config.static_cache_control</code> in favor of <code>config.public_file_server.headers</code>. (<a href="https://github.com/rails/rails/pull/19135">Pull Request</a>)</p></li> <li><p> Deprecated <code>config.serve_static_files</code> in favor of <code>config.public_file_server.enabled</code>. (<a href="https://github.com/rails/rails/pull/22173">Pull Request</a>)</p></li> <li><p> Deprecated the tasks in the <code>rails</code> task namespace in favor of the <code>app</code> namespace. (e.g. <code>rails:update</code> and <code>rails:template</code> tasks are renamed to <code>app:update</code> and <code>app:template</code>.) (<a href="https://github.com/rails/rails/pull/23439">Pull Request</a>)</p></li> </ul> <h3 id="railties-notable-changes"><a class="anchorlink" href="#railties-notable-changes" data-turbo="false"><span>3.3</span> Notable changes</a></h3> <ul> <li><p> Added Rails test runner <code>bin/rails test</code>. (<a href="https://github.com/rails/rails/pull/19216">Pull Request</a>)</p></li> <li><p> Newly generated applications and plugins get a <code>README.md</code> in Markdown. (<a href="https://github.com/rails/rails/commit/89a12c931b1f00b90e74afffcdc2fc21f14ca663">commit</a>, <a href="https://github.com/rails/rails/pull/22068">Pull Request</a>)</p></li> <li><p> Added <code>bin/rails restart</code> task to restart your Rails app by touching <code>tmp/restart.txt</code>. (<a href="https://github.com/rails/rails/pull/18965">Pull Request</a>)</p></li> <li><p> Added <code>bin/rails initializers</code> task to print out all defined initializers in the order they are invoked by Rails. (<a href="https://github.com/rails/rails/pull/19323">Pull Request</a>)</p></li> <li><p> Added <code>bin/rails dev:cache</code> to enable or disable caching in development mode. (<a href="https://github.com/rails/rails/pull/20961">Pull Request</a>)</p></li> <li><p> Added <code>bin/update</code> script to update the development environment automatically. (<a href="https://github.com/rails/rails/pull/20972">Pull Request</a>)</p></li> <li><p> Proxy Rake tasks through <code>bin/rails</code>. (<a href="https://github.com/rails/rails/pull/22457">Pull Request</a>, <a href="https://github.com/rails/rails/pull/22288">Pull Request</a>)</p></li> <li><p> New applications are generated with the evented file system monitor enabled on Linux and macOS. The feature can be opted out by passing <code>--skip-listen</code> to the generator. (<a href="https://github.com/rails/rails/commit/de6ad5665d2679944a9ee9407826ba88395a1003">commit</a>, <a href="https://github.com/rails/rails/commit/94dbc48887bf39c241ee2ce1741ee680d773f202">commit</a>)</p></li> <li><p> Generate applications with an option to log to STDOUT in production using the environment variable <code>RAILS_LOG_TO_STDOUT</code>. (<a href="https://github.com/rails/rails/pull/23734">Pull Request</a>)</p></li> <li><p> Enable HSTS with IncludeSubdomains header for new applications. (<a href="https://github.com/rails/rails/pull/23852">Pull Request</a>)</p></li> <li><p> The application generator writes a new file <code>config/spring.rb</code>, which tells Spring to watch additional common files. (<a href="https://github.com/rails/rails/commit/b04d07337fd7bc17e88500e9d6bcd361885a45f8">commit</a>)</p></li> <li><p> Added <code>--skip-action-mailer</code> to skip Action Mailer while generating new app. (<a href="https://github.com/rails/rails/pull/18288">Pull Request</a>)</p></li> <li><p> Removed <code>tmp/sessions</code> directory and the clear rake task associated with it. (<a href="https://github.com/rails/rails/pull/18314">Pull Request</a>)</p></li> <li><p> Changed <code>_form.html.erb</code> generated by scaffold generator to use local variables. (<a href="https://github.com/rails/rails/pull/13434">Pull Request</a>)</p></li> <li><p> Disabled autoloading of classes in production environment. (<a href="https://github.com/rails/rails/commit/a71350cae0082193ad8c66d65ab62e8bb0b7853b">commit</a>)</p></li> </ul> <h2 id="action-pack"><a class="anchorlink" href="#action-pack" data-turbo="false"><span>4</span> Action Pack</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/actionpack/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="action-pack-removals"><a class="anchorlink" href="#action-pack-removals" data-turbo="false"><span>4.1</span> Removals</a></h3> <ul> <li><p> Removed <code>ActionDispatch::Request::Utils.deep_munge</code>. (<a href="https://github.com/rails/rails/commit/52cf1a71b393486435fab4386a8663b146608996">commit</a>)</p></li> <li><p> Removed <code>ActionController::HideActions</code>. (<a href="https://github.com/rails/rails/pull/18371">Pull Request</a>)</p></li> <li><p> Removed <code>respond_to</code> and <code>respond_with</code> placeholder methods, this functionality has been extracted to the <a href="https://github.com/plataformatec/responders">responders</a> gem. (<a href="https://github.com/rails/rails/commit/afd5e9a7ff0072e482b0b0e8e238d21b070b6280">commit</a>)</p></li> <li><p> Removed deprecated assertion files. (<a href="https://github.com/rails/rails/commit/92e27d30d8112962ee068f7b14aa7b10daf0c976">commit</a>)</p></li> <li><p> Removed deprecated usage of string keys in URL helpers. (<a href="https://github.com/rails/rails/commit/34e380764edede47f7ebe0c7671d6f9c9dc7e809">commit</a>)</p></li> <li><p> Removed deprecated <code>only_path</code> option on <code>*_path</code> helpers. (<a href="https://github.com/rails/rails/commit/e4e1fd7ade47771067177254cb133564a3422b8a">commit</a>)</p></li> <li><p> Removed deprecated <code>NamedRouteCollection#helpers</code>. (<a href="https://github.com/rails/rails/commit/2cc91c37bc2e32b7a04b2d782fb8f4a69a14503f">commit</a>)</p></li> <li><p> Removed deprecated support to define routes with <code>:to</code> option that doesn't contain <code>#</code>. (<a href="https://github.com/rails/rails/commit/1f3b0a8609c00278b9a10076040ac9c90a9cc4a6">commit</a>)</p></li> <li><p> Removed deprecated <code>ActionDispatch::Response#to_ary</code>. (<a href="https://github.com/rails/rails/commit/4b19d5b7bcdf4f11bd1e2e9ed2149a958e338c01">commit</a>)</p></li> <li><p> Removed deprecated <code>ActionDispatch::Request#deep_munge</code>. (<a href="https://github.com/rails/rails/commit/7676659633057dacd97b8da66e0d9119809b343e">commit</a>)</p></li> <li><p> Removed deprecated <code>ActionDispatch::Http::Parameters#symbolized_path_parameters</code>. (<a href="https://github.com/rails/rails/commit/7fe7973cd8bd119b724d72c5f617cf94c18edf9e">commit</a>)</p></li> <li><p> Removed deprecated option <code>use_route</code> in controller tests. (<a href="https://github.com/rails/rails/commit/e4cfd353a47369dd32198b0e67b8cbb2f9a1c548">commit</a>)</p></li> <li><p> Removed <code>assigns</code> and <code>assert_template</code>. Both methods have been extracted into the <a href="https://github.com/rails/rails-controller-testing">rails-controller-testing</a> gem. (<a href="https://github.com/rails/rails/pull/20138">Pull Request</a>)</p></li> </ul> <h3 id="action-pack-deprecations"><a class="anchorlink" href="#action-pack-deprecations" data-turbo="false"><span>4.2</span> Deprecations</a></h3> <ul> <li><p> Deprecated all <code>*_filter</code> callbacks in favor of <code>*_action</code> callbacks. (<a href="https://github.com/rails/rails/pull/18410">Pull Request</a>)</p></li> <li><p> Deprecated <code>*_via_redirect</code> integration test methods. Use <code>follow_redirect!</code> manually after the request call for the same behavior. (<a href="https://github.com/rails/rails/pull/18693">Pull Request</a>)</p></li> <li><p> Deprecated <code>AbstractController#skip_action_callback</code> in favor of individual skip_callback methods. (<a href="https://github.com/rails/rails/pull/19060">Pull Request</a>)</p></li> <li><p> Deprecated <code>:nothing</code> option for <code>render</code> method. (<a href="https://github.com/rails/rails/pull/20336">Pull Request</a>)</p></li> <li><p> Deprecated passing first parameter as <code>Hash</code> and default status code for <code>head</code> method. (<a href="https://github.com/rails/rails/pull/20407">Pull Request</a>)</p></li> <li><p> Deprecated using strings or symbols for middleware class names. Use class names instead. (<a href="https://github.com/rails/rails/commit/83b767ce">commit</a>)</p></li> <li><p> Deprecated accessing MIME types via constants (e.g. <code>Mime::HTML</code>). Use the subscript operator with a symbol instead (e.g. <code>Mime[:html]</code>). (<a href="https://github.com/rails/rails/pull/21869">Pull Request</a>)</p></li> <li><p> Deprecated <code>redirect_to :back</code> in favor of <code>redirect_back</code>, which accepts a required <code>fallback_location</code> argument, thus eliminating the possibility of a <code>RedirectBackError</code>. (<a href="https://github.com/rails/rails/pull/22506">Pull Request</a>)</p></li> <li><p> <code>ActionDispatch::IntegrationTest</code> and <code>ActionController::TestCase</code> deprecate positional arguments in favor of keyword arguments. (<a href="https://github.com/rails/rails/pull/18323">Pull Request</a>)</p></li> <li><p> Deprecated <code>:controller</code> and <code>:action</code> path parameters. (<a href="https://github.com/rails/rails/pull/23980">Pull Request</a>)</p></li> <li><p> Deprecated env method on controller instances. (<a href="https://github.com/rails/rails/commit/05934d24aff62d66fc62621aa38dae6456e276be">commit</a>)</p></li> <li><p> <code>ActionDispatch::ParamsParser</code> is deprecated and was removed from the middleware stack. To configure the parameter parsers use <code>ActionDispatch::Request.parameter_parsers=</code>. (<a href="https://github.com/rails/rails/commit/38d2bf5fd1f3e014f2397898d371c339baa627b1">commit</a>, <a href="https://github.com/rails/rails/commit/5ed38014811d4ce6d6f957510b9153938370173b">commit</a>)</p></li> </ul> <h3 id="action-pack-notable-changes"><a class="anchorlink" href="#action-pack-notable-changes" data-turbo="false"><span>4.3</span> Notable changes</a></h3> <ul> <li><p> Added <code>ActionController::Renderer</code> to render arbitrary templates outside controller actions. (<a href="https://github.com/rails/rails/pull/18546">Pull Request</a>)</p></li> <li><p> Migrating to keyword arguments syntax in <code>ActionController::TestCase</code> and <code>ActionDispatch::Integration</code> HTTP request methods. (<a href="https://github.com/rails/rails/pull/18323">Pull Request</a>)</p></li> <li><p> Added <code>http_cache_forever</code> to Action Controller, so we can cache a response that never gets expired. (<a href="https://github.com/rails/rails/pull/18394">Pull Request</a>)</p></li> <li><p> Provide friendlier access to request variants. (<a href="https://github.com/rails/rails/pull/18939">Pull Request</a>)</p></li> <li><p> For actions with no corresponding templates, render <code>head :no_content</code> instead of raising an error. (<a href="https://github.com/rails/rails/pull/19377">Pull Request</a>)</p></li> <li><p> Added the ability to override default form builder for a controller. (<a href="https://github.com/rails/rails/pull/19736">Pull Request</a>)</p></li> <li><p> Added support for API-only apps. <code>ActionController::API</code> is added as a replacement of <code>ActionController::Base</code> for this kind of applications. (<a href="https://github.com/rails/rails/pull/19832">Pull Request</a>)</p></li> <li><p> Make <code>ActionController::Parameters</code> no longer inherits from <code>HashWithIndifferentAccess</code>. (<a href="https://github.com/rails/rails/pull/20868">Pull Request</a>)</p></li> <li><p> Make it easier to opt in to <code>config.force_ssl</code> and <code>config.ssl_options</code> by making them less dangerous to try and easier to disable. (<a href="https://github.com/rails/rails/pull/21520">Pull Request</a>)</p></li> <li><p> Added the ability of returning arbitrary headers to <code>ActionDispatch::Static</code>. (<a href="https://github.com/rails/rails/pull/19135">Pull Request</a>)</p></li> <li><p> Changed the <code>protect_from_forgery</code> prepend default to <code>false</code>. (<a href="https://github.com/rails/rails/commit/39794037817703575c35a75f1961b01b83791191">commit</a>)</p></li> <li><p> <code>ActionController::TestCase</code> will be moved to its own gem in Rails 5.1. Use <code>ActionDispatch::IntegrationTest</code> instead. (<a href="https://github.com/rails/rails/commit/4414c5d1795e815b102571425974a8b1d46d932d">commit</a>)</p></li> <li><p> Rails generates weak ETags by default. (<a href="https://github.com/rails/rails/pull/17573">Pull Request</a>)</p></li> <li><p> Controller actions without an explicit <code>render</code> call and with no corresponding templates will render <code>head :no_content</code> implicitly instead of raising an error. (Pull Request <a href="https://github.com/rails/rails/pull/19377">1</a>, <a href="https://github.com/rails/rails/pull/23827">2</a>)</p></li> <li><p> Added an option for per-form CSRF tokens. (<a href="https://github.com/rails/rails/pull/22275">Pull Request</a>)</p></li> <li><p> Added request encoding and response parsing to integration tests. (<a href="https://github.com/rails/rails/pull/21671">Pull Request</a>)</p></li> <li><p> Add <code>ActionController#helpers</code> to get access to the view context at the controller level. (<a href="https://github.com/rails/rails/pull/24866">Pull Request</a>)</p></li> <li><p> Discarded flash messages get removed before storing into session. (<a href="https://github.com/rails/rails/pull/18721">Pull Request</a>)</p></li> <li><p> Added support for passing collection of records to <code>fresh_when</code> and <code>stale?</code>. (<a href="https://github.com/rails/rails/pull/18374">Pull Request</a>)</p></li> <li><p> <code>ActionController::Live</code> became an <code>ActiveSupport::Concern</code>. That means it can't be just included in other modules without extending them with <code>ActiveSupport::Concern</code> or <code>ActionController::Live</code> won't take effect in production. Some people may be using another module to include some special <code>Warden</code>/<code>Devise</code> authentication failure handling code as well since the middleware can't catch a <code>:warden</code> thrown by a spawned thread which is the case when using <code>ActionController::Live</code>. (<a href="https://github.com/rails/rails/issues/25581">More details in this issue</a>)</p></li> <li><p> Introduce <code>Response#strong_etag=</code> and <code>#weak_etag=</code> and analogous options for <code>fresh_when</code> and <code>stale?</code>. (<a href="https://github.com/rails/rails/pull/24387">Pull Request</a>)</p></li> </ul> <h2 id="action-view"><a class="anchorlink" href="#action-view" data-turbo="false"><span>5</span> Action View</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/actionview/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="action-view-removals"><a class="anchorlink" href="#action-view-removals" data-turbo="false"><span>5.1</span> Removals</a></h3> <ul> <li><p> Removed deprecated <code>AbstractController::Base::parent_prefixes</code>. (<a href="https://github.com/rails/rails/commit/34bcbcf35701ca44be559ff391535c0dd865c333">commit</a>)</p></li> <li><p> Removed <code>ActionView::Helpers::RecordTagHelper</code>, this functionality has been extracted to the <a href="https://github.com/rails/record_tag_helper">record_tag_helper</a> gem. (<a href="https://github.com/rails/rails/pull/18411">Pull Request</a>)</p></li> <li><p> Removed <code>:rescue_format</code> option for <code>translate</code> helper since it's no longer supported by I18n. (<a href="https://github.com/rails/rails/pull/20019">Pull Request</a>)</p></li> </ul> <h3 id="action-view-notable-changes"><a class="anchorlink" href="#action-view-notable-changes" data-turbo="false"><span>5.2</span> Notable Changes</a></h3> <ul> <li><p> Changed the default template handler from <code>ERB</code> to <code>Raw</code>. (<a href="https://github.com/rails/rails/commit/4be859f0fdf7b3059a28d03c279f03f5938efc80">commit</a>)</p></li> <li><p> Collection rendering can cache and fetches multiple partials at once. (<a href="https://github.com/rails/rails/pull/18948">Pull Request</a>, <a href="https://github.com/rails/rails/commit/e93f0f0f133717f9b06b1eaefd3442bd0ff43985">commit</a>)</p></li> <li><p> Added wildcard matching to explicit dependencies. (<a href="https://github.com/rails/rails/pull/20904">Pull Request</a>)</p></li> <li><p> Make <code>disable_with</code> the default behavior for submit tags. Disables the button on submit to prevent double submits. (<a href="https://github.com/rails/rails/pull/21135">Pull Request</a>)</p></li> <li><p> Partial template name no longer has to be a valid Ruby identifier. (<a href="https://github.com/rails/rails/commit/da9038e">commit</a>)</p></li> <li><p> The <code>datetime_tag</code> helper now generates an input tag with the type of <code>datetime-local</code>. (<a href="https://github.com/rails/rails/pull/25469">Pull Request</a>)</p></li> <li><p> Allow blocks while rendering with the <code>render partial:</code> helper. (<a href="https://github.com/rails/rails/pull/17974">Pull Request</a>)</p></li> </ul> <h2 id="action-mailer"><a class="anchorlink" href="#action-mailer" data-turbo="false"><span>6</span> Action Mailer</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/actionmailer/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="action-mailer-removals"><a class="anchorlink" href="#action-mailer-removals" data-turbo="false"><span>6.1</span> Removals</a></h3> <ul> <li><p> Removed deprecated <code>*_path</code> helpers in email views. (<a href="https://github.com/rails/rails/commit/d282125a18c1697a9b5bb775628a2db239142ac7">commit</a>)</p></li> <li><p> Removed deprecated <code>deliver</code> and <code>deliver!</code> methods. (<a href="https://github.com/rails/rails/commit/755dcd0691f74079c24196135f89b917062b0715">commit</a>)</p></li> </ul> <h3 id="action-mailer-notable-changes"><a class="anchorlink" href="#action-mailer-notable-changes" data-turbo="false"><span>6.2</span> Notable changes</a></h3> <ul> <li><p> Template lookup now respects default locale and I18n fallbacks. (<a href="https://github.com/rails/rails/commit/ecb1981b">commit</a>)</p></li> <li><p> Added <code>_mailer</code> suffix to mailers created via generator, following the same naming convention used in controllers and jobs. (<a href="https://github.com/rails/rails/pull/18074">Pull Request</a>)</p></li> <li><p> Added <code>assert_enqueued_emails</code> and <code>assert_no_enqueued_emails</code>. (<a href="https://github.com/rails/rails/pull/18403">Pull Request</a>)</p></li> <li><p> Added <code>config.action_mailer.deliver_later_queue_name</code> configuration to set the mailer queue name. (<a href="https://github.com/rails/rails/pull/18587">Pull Request</a>)</p></li> <li><p> Added support for fragment caching in Action Mailer views. Added new config option <code>config.action_mailer.perform_caching</code> to determine whether your templates should perform caching or not. (<a href="https://github.com/rails/rails/pull/22825">Pull Request</a>)</p></li> </ul> <h2 id="active-record"><a class="anchorlink" href="#active-record" data-turbo="false"><span>7</span> Active Record</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/activerecord/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="active-record-removals"><a class="anchorlink" href="#active-record-removals" data-turbo="false"><span>7.1</span> Removals</a></h3> <ul> <li><p> Removed deprecated behavior allowing nested arrays to be passed as query values. (<a href="https://github.com/rails/rails/pull/17919">Pull Request</a>)</p></li> <li><p> Removed deprecated <code>ActiveRecord::Tasks::DatabaseTasks#load_schema</code>. This method was replaced by <code>ActiveRecord::Tasks::DatabaseTasks#load_schema_for</code>. (<a href="https://github.com/rails/rails/commit/ad783136d747f73329350b9bb5a5e17c8f8800da">commit</a>)</p></li> <li><p> Removed deprecated <code>serialized_attributes</code>. (<a href="https://github.com/rails/rails/commit/82043ab53cb186d59b1b3be06122861758f814b2">commit</a>)</p></li> <li><p> Removed deprecated automatic counter caches on <code>has_many :through</code>. (<a href="https://github.com/rails/rails/commit/87c8ce340c6c83342df988df247e9035393ed7a0">commit</a>)</p></li> <li><p> Removed deprecated <code>sanitize_sql_hash_for_conditions</code>. (<a href="https://github.com/rails/rails/commit/3a59dd212315ebb9bae8338b98af259ac00bbef3">commit</a>)</p></li> <li><p> Removed deprecated <code>Reflection#source_macro</code>. (<a href="https://github.com/rails/rails/commit/ede8c199a85cfbb6457d5630ec1e285e5ec49313">commit</a>)</p></li> <li><p> Removed deprecated <code>symbolized_base_class</code> and <code>symbolized_sti_name</code>. (<a href="https://github.com/rails/rails/commit/9013e28e52eba3a6ffcede26f85df48d264b8951">commit</a>)</p></li> <li><p> Removed deprecated <code>ActiveRecord::Base.disable_implicit_join_references=</code>. (<a href="https://github.com/rails/rails/commit/0fbd1fc888ffb8cbe1191193bf86933110693dfc">commit</a>)</p></li> <li><p> Removed deprecated access to connection specification using a string accessor. (<a href="https://github.com/rails/rails/commit/efdc20f36ccc37afbb2705eb9acca76dd8aabd4f">commit</a>)</p></li> <li><p> Removed deprecated support to preload instance-dependent associations. (<a href="https://github.com/rails/rails/commit/4ed97979d14c5e92eb212b1a629da0a214084078">commit</a>)</p></li> <li><p> Removed deprecated support for PostgreSQL ranges with exclusive lower bounds. (<a href="https://github.com/rails/rails/commit/a076256d63f64d194b8f634890527a5ed2651115">commit</a>)</p></li> <li><p> Removed deprecation when modifying a relation with cached Arel. This raises an <code>ImmutableRelation</code> error instead. (<a href="https://github.com/rails/rails/commit/3ae98181433dda1b5e19910e107494762512a86c">commit</a>)</p></li> <li><p> Removed <code>ActiveRecord::Serialization::XmlSerializer</code> from core. This feature has been extracted into the <a href="https://github.com/rails/activemodel-serializers-xml">activemodel-serializers-xml</a> gem. (<a href="https://github.com/rails/rails/pull/21161">Pull Request</a>)</p></li> <li><p> Removed support for the legacy <code>mysql</code> database adapter from core. Most users should be able to use <code>mysql2</code>. It will be converted to a separate gem when we find someone to maintain it. (<a href="https://github.com/rails/rails/pull/22642">Pull Request 1</a>, <a href="https://github.com/rails/rails/pull/22715">Pull Request 2</a>)</p></li> <li><p> Removed support for the <code>protected_attributes</code> gem. (<a href="https://github.com/rails/rails/commit/f4fbc0301021f13ae05c8e941c8efc4ae351fdf9">commit</a>)</p></li> <li><p> Removed support for PostgreSQL versions below 9.1. (<a href="https://github.com/rails/rails/pull/23434">Pull Request</a>)</p></li> <li><p> Removed support for <code>activerecord-deprecated_finders</code> gem. (<a href="https://github.com/rails/rails/commit/78dab2a8569408658542e462a957ea5a35aa4679">commit</a>)</p></li> <li><p> Removed <code>ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES</code> constant. (<a href="https://github.com/rails/rails/commit/a502703c3d2151d4d3b421b29fefdac5ad05df61">commit</a>)</p></li> </ul> <h3 id="active-record-deprecations"><a class="anchorlink" href="#active-record-deprecations" data-turbo="false"><span>7.2</span> Deprecations</a></h3> <ul> <li><p> Deprecated passing a class as a value in a query. Users should pass strings instead. (<a href="https://github.com/rails/rails/pull/17916">Pull Request</a>)</p></li> <li><p> Deprecated returning <code>false</code> as a way to halt Active Record callback chains. The recommended way is to <code>throw(:abort)</code>. (<a href="https://github.com/rails/rails/pull/17227">Pull Request</a>)</p></li> <li><p> Deprecated <code>ActiveRecord::Base.errors_in_transactional_callbacks=</code>. (<a href="https://github.com/rails/rails/commit/07d3d402341e81ada0214f2cb2be1da69eadfe72">commit</a>)</p></li> <li><p> Deprecated <code>Relation#uniq</code> use <code>Relation#distinct</code> instead. (<a href="https://github.com/rails/rails/commit/adfab2dcf4003ca564d78d4425566dd2d9cd8b4f">commit</a>)</p></li> <li><p> Deprecated the PostgreSQL <code>:point</code> type in favor of a new one which will return <code>Point</code> objects instead of an <code>Array</code> (<a href="https://github.com/rails/rails/pull/20448">Pull Request</a>)</p></li> <li><p> Deprecated force association reload by passing a truthy argument to association method. (<a href="https://github.com/rails/rails/pull/20888">Pull Request</a>)</p></li> <li><p> Deprecated the keys for association <code>restrict_dependent_destroy</code> errors in favor of new key names. (<a href="https://github.com/rails/rails/pull/20668">Pull Request</a>)</p></li> <li><p> Synchronize behavior of <code>#tables</code>. (<a href="https://github.com/rails/rails/pull/21601">Pull Request</a>)</p></li> <li><p> Deprecated <code>SchemaCache#tables</code>, <code>SchemaCache#table_exists?</code> and <code>SchemaCache#clear_table_cache!</code> in favor of their new data source counterparts. (<a href="https://github.com/rails/rails/pull/21715">Pull Request</a>)</p></li> <li><p> Deprecated <code>connection.tables</code> on the SQLite3 and MySQL adapters. (<a href="https://github.com/rails/rails/pull/21601">Pull Request</a>)</p></li> <li><p> Deprecated passing arguments to <code>#tables</code> - the <code>#tables</code> method of some adapters (mysql2, sqlite3) would return both tables and views while others (postgresql) just return tables. To make their behavior consistent, <code>#tables</code> will return only tables in the future. (<a href="https://github.com/rails/rails/pull/21601">Pull Request</a>)</p></li> <li><p> Deprecated <code>table_exists?</code> - The <code>#table_exists?</code> method would check both tables and views. To make their behavior consistent with <code>#tables</code>, <code>#table_exists?</code> will check only tables in the future. (<a href="https://github.com/rails/rails/pull/21601">Pull Request</a>)</p></li> <li><p> Deprecate sending the <code>offset</code> argument to <code>find_nth</code>. Please use the <code>offset</code> method on relation instead. (<a href="https://github.com/rails/rails/pull/22053">Pull Request</a>)</p></li> <li><p> Deprecated <code>{insert|update|delete}_sql</code> in <code>DatabaseStatements</code>. Use the <code>{insert|update|delete}</code> public methods instead. (<a href="https://github.com/rails/rails/pull/23086">Pull Request</a>)</p></li> <li><p> Deprecated <code>use_transactional_fixtures</code> in favor of <code>use_transactional_tests</code> for more clarity. (<a href="https://github.com/rails/rails/pull/19282">Pull Request</a>)</p></li> <li><p> Deprecated passing a column to <code>ActiveRecord::Connection#quote</code>. (<a href="https://github.com/rails/rails/commit/7bb620869725ad6de603f6a5393ee17df13aa96c">commit</a>)</p></li> <li><p> Added an option <code>end</code> to <code>find_in_batches</code> that complements the <code>start</code> parameter to specify where to stop batch processing. (<a href="https://github.com/rails/rails/pull/12257">Pull Request</a>)</p></li> </ul> <h3 id="active-record-notable-changes"><a class="anchorlink" href="#active-record-notable-changes" data-turbo="false"><span>7.3</span> Notable changes</a></h3> <ul> <li><p> Added a <code>foreign_key</code> option to <code>references</code> while creating the table. (<a href="https://github.com/rails/rails/commit/99a6f9e60ea55924b44f894a16f8de0162cf2702">commit</a>)</p></li> <li><p> New attributes API. (<a href="https://github.com/rails/rails/commit/8c752c7ac739d5a86d4136ab1e9d0142c4041e58">commit</a>)</p></li> <li><p> Added <code>:_prefix</code>/<code>:_suffix</code> option to <code>enum</code> definition. (<a href="https://github.com/rails/rails/pull/19813">Pull Request</a>, <a href="https://github.com/rails/rails/pull/20999">Pull Request</a>)</p></li> <li><p> Added <code>#cache_key</code> to <code>ActiveRecord::Relation</code>. (<a href="https://github.com/rails/rails/pull/20884">Pull Request</a>)</p></li> <li><p> Changed the default <code>null</code> value for <code>timestamps</code> to <code>false</code>. (<a href="https://github.com/rails/rails/commit/a939506f297b667291480f26fa32a373a18ae06a">commit</a>)</p></li> <li><p> Added <code>ActiveRecord::SecureToken</code> in order to encapsulate generation of unique tokens for attributes in a model using <code>SecureRandom</code>. (<a href="https://github.com/rails/rails/pull/18217">Pull Request</a>)</p></li> <li><p> Added <code>:if_exists</code> option for <code>drop_table</code>. (<a href="https://github.com/rails/rails/pull/18597">Pull Request</a>)</p></li> <li><p> Added <code>ActiveRecord::Base#accessed_fields</code>, which can be used to quickly discover which fields were read from a model when you are looking to only select the data you need from the database. (<a href="https://github.com/rails/rails/commit/be9b68038e83a617eb38c26147659162e4ac3d2c">commit</a>)</p></li> <li><p> Added the <code>#or</code> method on <code>ActiveRecord::Relation</code>, allowing use of the OR operator to combine WHERE or HAVING clauses. (<a href="https://github.com/rails/rails/commit/b0b37942d729b6bdcd2e3178eda7fa1de203b3d0">commit</a>)</p></li> <li><p> Added <code>ActiveRecord::Base.suppress</code> to prevent the receiver from being saved during the given block. (<a href="https://github.com/rails/rails/pull/18910">Pull Request</a>)</p></li> <li><p> <code>belongs_to</code> will now trigger a validation error by default if the association is not present. You can turn this off on a per-association basis with <code>optional: true</code>. Also deprecate <code>required</code> option in favor of <code>optional</code> for <code>belongs_to</code>. (<a href="https://github.com/rails/rails/pull/18937">Pull Request</a>)</p></li> <li><p> Added <code>config.active_record.dump_schemas</code> to configure the behavior of <code>db:structure:dump</code>. (<a href="https://github.com/rails/rails/pull/19347">Pull Request</a>)</p></li> <li><p> Added <code>config.active_record.warn_on_records_fetched_greater_than</code> option. (<a href="https://github.com/rails/rails/pull/18846">Pull Request</a>)</p></li> <li><p> Added a native JSON data type support in MySQL. (<a href="https://github.com/rails/rails/pull/21110">Pull Request</a>)</p></li> <li><p> Added support for dropping indexes concurrently in PostgreSQL. (<a href="https://github.com/rails/rails/pull/21317">Pull Request</a>)</p></li> <li><p> Added <code>#views</code> and <code>#view_exists?</code> methods on connection adapters. (<a href="https://github.com/rails/rails/pull/21609">Pull Request</a>)</p></li> <li><p> Added <code>ActiveRecord::Base.ignored_columns</code> to make some columns invisible from Active Record. (<a href="https://github.com/rails/rails/pull/21720">Pull Request</a>)</p></li> <li><p> Added <code>connection.data_sources</code> and <code>connection.data_source_exists?</code>. These methods determine what relations can be used to back Active Record models (usually tables and views). (<a href="https://github.com/rails/rails/pull/21715">Pull Request</a>)</p></li> <li><p> Allow fixtures files to set the model class in the YAML file itself. (<a href="https://github.com/rails/rails/pull/20574">Pull Request</a>)</p></li> <li><p> Added ability to default to <code>uuid</code> as primary key when generating database migrations. (<a href="https://github.com/rails/rails/pull/21762">Pull Request</a>)</p></li> <li><p> Added <code>ActiveRecord::Relation#left_joins</code> and <code>ActiveRecord::Relation#left_outer_joins</code>. (<a href="https://github.com/rails/rails/pull/12071">Pull Request</a>)</p></li> <li><p> Added <code>after_{create,update,delete}_commit</code> callbacks. (<a href="https://github.com/rails/rails/pull/22516">Pull Request</a>)</p></li> <li><p> Version the API presented to migration classes, so we can change parameter defaults without breaking existing migrations, or forcing them to be rewritten through a deprecation cycle. (<a href="https://github.com/rails/rails/pull/21538">Pull Request</a>)</p></li> <li><p> <code>ApplicationRecord</code> is a new superclass for all app models, analogous to app controllers subclassing <code>ApplicationController</code> instead of <code>ActionController::Base</code>. This gives apps a single spot to configure app-wide model behavior. (<a href="https://github.com/rails/rails/pull/22567">Pull Request</a>)</p></li> <li><p> Added ActiveRecord <code>#second_to_last</code> and <code>#third_to_last</code> methods. (<a href="https://github.com/rails/rails/pull/23583">Pull Request</a>)</p></li> <li><p> Added ability to annotate database objects (tables, columns, indexes) with comments stored in database metadata for PostgreSQL &amp; MySQL. (<a href="https://github.com/rails/rails/pull/22911">Pull Request</a>)</p></li> <li><p> Added prepared statements support to <code>mysql2</code> adapter, for mysql2 0.4.4+, Previously this was only supported on the deprecated <code>mysql</code> legacy adapter. To enable, set <code>prepared_statements: true</code> in <code>config/database.yml</code>. (<a href="https://github.com/rails/rails/pull/23461">Pull Request</a>)</p></li> <li><p> Added ability to call <code>ActiveRecord::Relation#update</code> on relation objects which will run validations on callbacks on all objects in the relation. (<a href="https://github.com/rails/rails/pull/11898">Pull Request</a>)</p></li> <li><p> Added <code>:touch</code> option to the <code>save</code> method so that records can be saved without updating timestamps. (<a href="https://github.com/rails/rails/pull/18225">Pull Request</a>)</p></li> <li><p> Added expression indexes and operator classes support for PostgreSQL. (<a href="https://github.com/rails/rails/commit/edc2b7718725016e988089b5fb6d6fb9d6e16882">commit</a>)</p></li> <li><p> Added <code>:index_errors</code> option to add indexes to errors of nested attributes. (<a href="https://github.com/rails/rails/pull/19686">Pull Request</a>)</p></li> <li><p> Added support for bidirectional destroy dependencies. (<a href="https://github.com/rails/rails/pull/18548">Pull Request</a>)</p></li> <li><p> Added support for <code>after_commit</code> callbacks in transactional tests. (<a href="https://github.com/rails/rails/pull/18458">Pull Request</a>)</p></li> <li><p> Added <code>foreign_key_exists?</code> method to see if a foreign key exists on a table or not. (<a href="https://github.com/rails/rails/pull/18662">Pull Request</a>)</p></li> <li><p> Added <code>:time</code> option to <code>touch</code> method to touch records with different time than the current time. (<a href="https://github.com/rails/rails/pull/18956">Pull Request</a>)</p></li> <li><p> Change transaction callbacks to not swallow errors. Before this change any errors raised inside a transaction callback were getting rescued and printed in the logs, unless you used the (newly deprecated) <code>raise_in_transactional_callbacks = true</code> option.</p><p>Now these errors are not rescued anymore and just bubble up, matching the behavior of other callbacks. (<a href="https://github.com/rails/rails/commit/07d3d402341e81ada0214f2cb2be1da69eadfe72">commit</a>)</p></li> </ul> <h2 id="active-model"><a class="anchorlink" href="#active-model" data-turbo="false"><span>8</span> Active Model</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/activemodel/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="active-model-removals"><a class="anchorlink" href="#active-model-removals" data-turbo="false"><span>8.1</span> Removals</a></h3> <ul> <li><p> Removed deprecated <code>ActiveModel::Dirty#reset_#{attribute}</code> and <code>ActiveModel::Dirty#reset_changes</code>. (<a href="https://github.com/rails/rails/commit/37175a24bd508e2983247ec5d011d57df836c743">Pull Request</a>)</p></li> <li><p> Removed XML serialization. This feature has been extracted into the <a href="https://github.com/rails/activemodel-serializers-xml">activemodel-serializers-xml</a> gem. (<a href="https://github.com/rails/rails/pull/21161">Pull Request</a>)</p></li> <li><p> Removed <code>ActionController::ModelNaming</code> module. (<a href="https://github.com/rails/rails/pull/18194">Pull Request</a>)</p></li> </ul> <h3 id="active-model-deprecations"><a class="anchorlink" href="#active-model-deprecations" data-turbo="false"><span>8.2</span> Deprecations</a></h3> <ul> <li><p> Deprecated returning <code>false</code> as a way to halt Active Model and <code>ActiveModel::Validations</code> callback chains. The recommended way is to <code>throw(:abort)</code>. (<a href="https://github.com/rails/rails/pull/17227">Pull Request</a>)</p></li> <li><p> Deprecated <code>ActiveModel::Errors#get</code>, <code>ActiveModel::Errors#set</code> and <code>ActiveModel::Errors#[]=</code> methods that have inconsistent behavior. (<a href="https://github.com/rails/rails/pull/18634">Pull Request</a>)</p></li> <li><p> Deprecated the <code>:tokenizer</code> option for <code>validates_length_of</code>, in favor of plain Ruby. (<a href="https://github.com/rails/rails/pull/19585">Pull Request</a>)</p></li> <li><p> Deprecated <code>ActiveModel::Errors#add_on_empty</code> and <code>ActiveModel::Errors#add_on_blank</code> with no replacement. (<a href="https://github.com/rails/rails/pull/18996">Pull Request</a>)</p></li> </ul> <h3 id="active-model-notable-changes"><a class="anchorlink" href="#active-model-notable-changes" data-turbo="false"><span>8.3</span> Notable changes</a></h3> <ul> <li><p> Added <code>ActiveModel::Errors#details</code> to determine what validator has failed. (<a href="https://github.com/rails/rails/pull/18322">Pull Request</a>)</p></li> <li><p> Extracted <code>ActiveRecord::AttributeAssignment</code> to <code>ActiveModel::AttributeAssignment</code> allowing to use it for any object as an includable module. (<a href="https://github.com/rails/rails/pull/10776">Pull Request</a>)</p></li> <li><p> Added <code>ActiveModel::Dirty#[attr_name]_previously_changed?</code> and <code>ActiveModel::Dirty#[attr_name]_previous_change</code> to improve access to recorded changes after the model has been saved. (<a href="https://github.com/rails/rails/pull/19847">Pull Request</a>)</p></li> <li><p> Validate multiple contexts on <code>valid?</code> and <code>invalid?</code> at once. (<a href="https://github.com/rails/rails/pull/21069">Pull Request</a>)</p></li> <li><p> Change <code>validates_acceptance_of</code> to accept <code>true</code> as default value apart from <code>1</code>. (<a href="https://github.com/rails/rails/pull/18439">Pull Request</a>)</p></li> </ul> <h2 id="active-job"><a class="anchorlink" href="#active-job" data-turbo="false"><span>9</span> Active Job</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/activejob/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="active-job-notable-changes"><a class="anchorlink" href="#active-job-notable-changes" data-turbo="false"><span>9.1</span> Notable changes</a></h3> <ul> <li><p> <code>ActiveJob::Base.deserialize</code> delegates to the job class. This allows jobs to attach arbitrary metadata when they get serialized and read it back when they get performed. (<a href="https://github.com/rails/rails/pull/18260">Pull Request</a>)</p></li> <li><p> Add ability to configure the queue adapter on a per job basis without affecting each other. (<a href="https://github.com/rails/rails/pull/16992">Pull Request</a>)</p></li> <li><p> A generated job now inherits from <code>app/jobs/application_job.rb</code> by default. (<a href="https://github.com/rails/rails/pull/19034">Pull Request</a>)</p></li> <li><p> Allow <code>DelayedJob</code>, <code>Sidekiq</code>, <code>qu</code>, <code>que</code>, and <code>queue_classic</code> to report the job id back to <code>ActiveJob::Base</code> as <code>provider_job_id</code>. (<a href="https://github.com/rails/rails/pull/20064">Pull Request</a>, <a href="https://github.com/rails/rails/pull/20056">Pull Request</a>, <a href="https://github.com/rails/rails/commit/68e3279163d06e6b04e043f91c9470e9259bbbe0">commit</a>)</p></li> <li><p> Implement a simple <code>AsyncJob</code> processor and associated <code>AsyncAdapter</code> that queue jobs to a <code>concurrent-ruby</code> thread pool. (<a href="https://github.com/rails/rails/pull/21257">Pull Request</a>)</p></li> <li><p> Change the default adapter from inline to async. It's a better default as tests will then not mistakenly come to rely on behavior happening synchronously. (<a href="https://github.com/rails/rails/commit/625baa69d14881ac49ba2e5c7d9cac4b222d7022">commit</a>)</p></li> </ul> <h2 id="active-support"><a class="anchorlink" href="#active-support" data-turbo="false"><span>10</span> Active Support</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/5-0-stable/activesupport/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="removals"><a class="anchorlink" href="#removals" data-turbo="false"><span>10.1</span> Removals</a></h3> <ul> <li><p> Removed deprecated <code>ActiveSupport::JSON::Encoding::CircularReferenceError</code>. (<a href="https://github.com/rails/rails/commit/d6e06ea8275cdc3f126f926ed9b5349fde374b10">commit</a>)</p></li> <li><p> Removed deprecated methods <code>ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=</code> and <code>ActiveSupport::JSON::Encoding.encode_big_decimal_as_string</code>. (<a href="https://github.com/rails/rails/commit/c8019c0611791b2716c6bed48ef8dcb177b7869c">commit</a>)</p></li> <li><p> Removed deprecated <code>ActiveSupport::SafeBuffer#prepend</code>. (<a href="https://github.com/rails/rails/commit/e1c8b9f688c56aaedac9466a4343df955b4a67ec">commit</a>)</p></li> <li><p> Removed deprecated methods from <code>Kernel</code>. <code>silence_stderr</code>, <code>silence_stream</code>, <code>capture</code> and <code>quietly</code>. (<a href="https://github.com/rails/rails/commit/481e49c64f790e46f4aff3ed539ed227d2eb46cb">commit</a>)</p></li> <li><p> Removed deprecated <code>active_support/core_ext/big_decimal/yaml_conversions</code> file. (<a href="https://github.com/rails/rails/commit/98ea19925d6db642731741c3b91bd085fac92241">commit</a>)</p></li> <li><p> Removed deprecated methods <code>ActiveSupport::Cache::Store.instrument</code> and <code>ActiveSupport::Cache::Store.instrument=</code>. (<a href="https://github.com/rails/rails/commit/a3ce6ca30ed0e77496c63781af596b149687b6d7">commit</a>)</p></li> <li><p> Removed deprecated <code>Class#superclass_delegating_accessor</code>. Use <code>Class#class_attribute</code> instead. (<a href="https://github.com/rails/rails/pull/16938">Pull Request</a>)</p></li> <li><p> Removed deprecated <code>ThreadSafe::Cache</code>. Use <code>Concurrent::Map</code> instead. (<a href="https://github.com/rails/rails/pull/21679">Pull Request</a>)</p></li> <li><p> Removed <code>Object#itself</code> as it is implemented in Ruby 2.2. (<a href="https://github.com/rails/rails/pull/18244">Pull Request</a>)</p></li> </ul> <h3 id="deprecations"><a class="anchorlink" href="#deprecations" data-turbo="false"><span>10.2</span> Deprecations</a></h3> <ul> <li><p> Deprecated <code>MissingSourceFile</code> in favor of <code>LoadError</code>. (<a href="https://github.com/rails/rails/commit/734d97d2">commit</a>)</p></li> <li><p> Deprecated <code>alias_method_chain</code> in favour of <code>Module#prepend</code> introduced in Ruby 2.0. (<a href="https://github.com/rails/rails/pull/19434">Pull Request</a>)</p></li> <li><p> Deprecated <code>ActiveSupport::Concurrency::Latch</code> in favor of <code>Concurrent::CountDownLatch</code> from concurrent-ruby. (<a href="https://github.com/rails/rails/pull/20866">Pull Request</a>)</p></li> <li><p> Deprecated <code>:prefix</code> option of <code>number_to_human_size</code> with no replacement. (<a href="https://github.com/rails/rails/pull/21191">Pull Request</a>)</p></li> <li><p> Deprecated <code>Module#qualified_const_</code> in favour of the builtin <code>Module#const_</code> methods. (<a href="https://github.com/rails/rails/pull/17845">Pull Request</a>)</p></li> <li><p> Deprecated passing string to define callback. (<a href="https://github.com/rails/rails/pull/22598">Pull Request</a>)</p></li> <li><p> Deprecated <code>ActiveSupport::Cache::Store#namespaced_key</code>, <code>ActiveSupport::Cache::MemCachedStore#escape_key</code>, and <code>ActiveSupport::Cache::FileStore#key_file_path</code>. Use <code>normalize_key</code> instead. (<a href="https://github.com/rails/rails/pull/22215">Pull Request</a>, <a href="https://github.com/rails/rails/commit/a8f773b0">commit</a>)</p></li> <li><p> Deprecated <code>ActiveSupport::Cache::LocaleCache#set_cache_value</code> in favor of <code>write_cache_value</code>. (<a href="https://github.com/rails/rails/pull/22215">Pull Request</a>)</p></li> <li><p> Deprecated passing arguments to <code>assert_nothing_raised</code>. (<a href="https://github.com/rails/rails/pull/23789">Pull Request</a>)</p></li> <li><p> Deprecated <code>Module.local_constants</code> in favor of <code>Module.constants(false)</code>. (<a href="https://github.com/rails/rails/pull/23936">Pull Request</a>)</p></li> </ul> <h3 id="active-support-notable-changes"><a class="anchorlink" href="#active-support-notable-changes" data-turbo="false"><span>10.3</span> Notable changes</a></h3> <ul> <li><p> Added <code>#verified</code> and <code>#valid_message?</code> methods to <code>ActiveSupport::MessageVerifier</code>. (<a href="https://github.com/rails/rails/pull/17727">Pull Request</a>)</p></li> <li><p> Changed the way in which callback chains can be halted. The preferred method to halt a callback chain from now on is to explicitly <code>throw(:abort)</code>. (<a href="https://github.com/rails/rails/pull/17227">Pull Request</a>)</p></li> <li><p> New config option <code>config.active_support.halt_callback_chains_on_return_false</code> to specify whether ActiveRecord, ActiveModel, and ActiveModel::Validations callback chains can be halted by returning <code>false</code> in a 'before' callback. (<a href="https://github.com/rails/rails/pull/17227">Pull Request</a>)</p></li> <li><p> Changed the default test order from <code>:sorted</code> to <code>:random</code>. (<a href="https://github.com/rails/rails/commit/5f777e4b5ee2e3e8e6fd0e2a208ec2a4d25a960d">commit</a>)</p></li> <li><p> Added <code>#on_weekend?</code>, <code>#on_weekday?</code>, <code>#next_weekday</code>, <code>#prev_weekday</code> methods to <code>Date</code>, <code>Time</code>, and <code>DateTime</code>. (<a href="https://github.com/rails/rails/pull/18335">Pull Request</a>, <a href="https://github.com/rails/rails/pull/23687">Pull Request</a>)</p></li> <li><p> Added <code>same_time</code> option to <code>#next_week</code> and <code>#prev_week</code> for <code>Date</code>, <code>Time</code>, and <code>DateTime</code>. (<a href="https://github.com/rails/rails/pull/18335">Pull Request</a>)</p></li> <li><p> Added <code>#prev_day</code> and <code>#next_day</code> counterparts to <code>#yesterday</code> and <code>#tomorrow</code> for <code>Date</code>, <code>Time</code>, and <code>DateTime</code>. (<a href="https://github.com/rails/rails/pull/18335">Pull Request</a>)</p></li> <li><p> Added <code>SecureRandom.base58</code> for generation of random base58 strings. (<a href="https://github.com/rails/rails/commit/b1093977110f18ae0cafe56c3d99fc22a7d54d1b">commit</a>)</p></li> <li><p> Added <code>file_fixture</code> to <code>ActiveSupport::TestCase</code>. It provides a simple mechanism to access sample files in your test cases. (<a href="https://github.com/rails/rails/pull/18658">Pull Request</a>)</p></li> <li><p> Added <code>#without</code> on <code>Enumerable</code> and <code>Array</code> to return a copy of an enumerable without the specified elements. (<a href="https://github.com/rails/rails/pull/19157">Pull Request</a>)</p></li> <li><p> Added <code>ActiveSupport::ArrayInquirer</code> and <code>Array#inquiry</code>. (<a href="https://github.com/rails/rails/pull/18939">Pull Request</a>)</p></li> <li><p> Added <code>ActiveSupport::TimeZone#strptime</code> to allow parsing times as if from a given timezone. (<a href="https://github.com/rails/rails/commit/a5e507fa0b8180c3d97458a9b86c195e9857d8f6">commit</a>)</p></li> <li><p> Added <code>Integer#positive?</code> and <code>Integer#negative?</code> query methods in the vein of <code>Integer#zero?</code>. (<a href="https://github.com/rails/rails/commit/e54277a45da3c86fecdfa930663d7692fd083daa">commit</a>)</p></li> <li><p> Added a bang version to <code>ActiveSupport::OrderedOptions</code> get methods which will raise an <code>KeyError</code> if the value is <code>.blank?</code>. (<a href="https://github.com/rails/rails/pull/20208">Pull Request</a>)</p></li> <li><p> Added <code>Time.days_in_year</code> to return the number of days in the given year, or the current year if no argument is provided. (<a href="https://github.com/rails/rails/commit/2f4f4d2cf1e4c5a442459fc250daf66186d110fa">commit</a>)</p></li> <li><p> Added an evented file watcher to asynchronously detect changes in the application source code, routes, locales, etc. (<a href="https://github.com/rails/rails/pull/22254">Pull Request</a>)</p></li> <li><p> Added thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-thread. (<a href="https://github.com/rails/rails/pull/22630">Pull Request</a>)</p></li> <li><p> Added <code>Array#second_to_last</code> and <code>Array#third_to_last</code> methods. (<a href="https://github.com/rails/rails/pull/23583">Pull Request</a>)</p></li> <li><p> Publish <code>ActiveSupport::Executor</code> and <code>ActiveSupport::Reloader</code> APIs to allow components and libraries to manage, and participate in, the execution of application code, and the application reloading process. (<a href="https://github.com/rails/rails/pull/23807">Pull Request</a>)</p></li> <li><p> <code>ActiveSupport::Duration</code> now supports ISO8601 formatting and parsing. (<a href="https://github.com/rails/rails/pull/16917">Pull Request</a>)</p></li> <li><p> <code>ActiveSupport::JSON.decode</code> now supports parsing ISO8601 local times when <code>parse_json_times</code> is enabled. (<a href="https://github.com/rails/rails/pull/23011">Pull Request</a>)</p></li> <li><p> <code>ActiveSupport::JSON.decode</code> now return <code>Date</code> objects for date strings. (<a href="https://github.com/rails/rails/pull/23011">Pull Request</a>)</p></li> <li><p> Added ability to <code>TaggedLogging</code> to allow loggers to be instantiated multiple times so that they don't share tags with each other. (<a href="https://github.com/rails/rails/pull/9065">Pull Request</a>)</p></li> </ul> <h2 id="credits"><a class="anchorlink" href="#credits" data-turbo="false"><span>11</span> Credits</a></h2><p>See the <a href="https://contributors.rubyonrails.org/">full list of contributors to Rails</a> for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.</p> </section> <hr> <footer aria-labelledby="heading-feedback" role="region"> <h2 id="heading-feedback">Feedback</h2> <p> You're encouraged to help improve the quality of this guide. </p> <p> Please contribute if you see any typos or factual errors. To get started, you can read our <a href="https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation">documentation contributions</a> section. </p> <p> You may also find incomplete content or stuff that is not up to date. Please do add any missing documentation for main. Make sure to check <a href="https://edgeguides.rubyonrails.org">Edge Guides</a> first to verify if the issues are already fixed or not on the main branch. Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a> for style and conventions. </p> <p> If for whatever reason you spot something to fix but cannot patch it yourself, please <a href="https://github.com/rails/rails/issues">open an issue</a>. </p> <p>And last but not least, any kind of discussion regarding Ruby on Rails documentation is very welcome on the <a href="https://discuss.rubyonrails.org/c/rubyonrails-docs">official Ruby on Rails Forum</a>. </p> </footer> </div> </article> </main> <hr class="hide" /> <footer id="complementary"> <div class="wrapper"> <p>This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a> License</p> <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p> </div> </footer> <a href="#main-skip-link" class="back-to-top" data-turbo="false"><span class="visibly-hidden">Back to top</span></a> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10