CINXE.COM

Ruby on Rails 7.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 7.0 Release Notes — Ruby on Rails Guides</title> <link rel="stylesheet" type="text/css" href="stylesheets/style-74a32dfd0cef32332d4ee58c1c94ff69.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-2794201d063bd2e4dbd0f0874c2a3f6f.css" data-turbo-track="reload"> <link rel="icon" href="images/favicon.ico" sizes="any"> <link rel="apple-touch-icon" href="images/icon.png"> <link rel="canonical" href="https://guides.rubyonrails.org/7_0_release_notes.html"> <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-751b87e159daf790ddf7e8e88ad8465a.js" data-turbo-track="reload"></script> <meta property="og:title" content="Ruby on Rails 7.0 Release Notes — Ruby on Rails Guides" /> <meta name="description" content="Ruby on Rails 7.0 Release NotesHighlights in Rails 7.0: Ruby 2.7.0+ required, Ruby 3.0+ preferred" /> <meta property="og:description" content="Ruby on Rails 7.0 Release NotesHighlights in Rails 7.0: Ruby 2.7.0+ required, Ruby 3.0+ preferred" /> <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.2 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/7_0_release_notes.html" selected>8.0</option> <option value="https://guides.rubyonrails.org/v7.2/7_0_release_notes.html">7.2</option> <option value="https://guides.rubyonrails.org/v7.1/7_0_release_notes.html">7.1</option> <option value="https://guides.rubyonrails.org/v7.0/7_0_release_notes.html">7.0</option> <option value="https://guides.rubyonrails.org/v6.1/7_0_release_notes.html">6.1</option> <option value="https://guides.rubyonrails.org/v6.0/7_0_release_notes.html">6.0</option> <option value="https://guides.rubyonrails.org/v5.2/7_0_release_notes.html">5.2</option> <option value="https://guides.rubyonrails.org/v5.1/7_0_release_notes.html">5.1</option> <option value="https://guides.rubyonrails.org/v5.0/7_0_release_notes.html">5.0</option> <option value="https://guides.rubyonrails.org/v4.2/7_0_release_notes.html">4.2</option> <option value="https://guides.rubyonrails.org/v4.1/7_0_release_notes.html">4.1</option> <option value="https://guides.rubyonrails.org/v4.0/7_0_release_notes.html">4.0</option> <option value="https://guides.rubyonrails.org/v3.2/7_0_release_notes.html">3.2</option> <option value="https://guides.rubyonrails.org/v3.1/7_0_release_notes.html">3.1</option> <option value="https://guides.rubyonrails.org/v3.0/7_0_release_notes.html">3.0</option> <option value="https://guides.rubyonrails.org/v2.3/7_0_release_notes.html">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> <dd><a href="install_ruby_on_rails.html">Install Ruby on 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="action_controller_advanced_topics.html">Action Controller Advanced Topics</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="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="api_app.html">Using Rails for API-only Applications</a></dd> </div> <div class="guides-section"> <dt>Going to Production</dt> <dd><a href="tuning_performance_for_deployment.html">Tuning Performance for Deployment</a></dd> <dd><a href="caching_with_rails.html">Caching with Rails: An Overview</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> </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="8_0_release_notes.html">Version 8.0 - November 2024</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> <option value="install_ruby_on_rails.html">Install Ruby on 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="action_controller_advanced_topics.html">Action Controller Advanced Topics</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="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="api_app.html">Using Rails for API-only Applications</option> </optgroup> <optgroup label="Going to Production"> <option value="tuning_performance_for_deployment.html">Tuning Performance for Deployment</option> <option value="caching_with_rails.html">Caching with Rails: An Overview</option> <option value="security.html">Securing Rails Applications</option> <option value="error_reporting.html">Error Reporting in Rails Applications</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="8_0_release_notes.html">Version 8.0 - November 2024</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 7.0 Release Notes</h1><p>Highlights in Rails 7.0:</p> <ul> <li>Ruby 2.7.0+ required, Ruby 3.0+ preferred</li> </ul> <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-7-0">Upgrading to Rails 7.0</a></li> <li><a href="#major-features">Major Features</a></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-cable">Action Cable</a> <ul> <li><a href="#action-cable-removals">Removals</a></li> <li><a href="#action-cable-deprecations">Deprecations</a></li> <li><a href="#action-cable-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-deprecations">Deprecations</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-deprecations">Deprecations</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-storage">Active Storage</a> <ul> <li><a href="#active-storage-removals">Removals</a></li> <li><a href="#active-storage-deprecations">Deprecations</a></li> <li><a href="#active-storage-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-support">Active Support</a> <ul> <li><a href="#active-support-removals">Removals</a></li> <li><a href="#active-support-deprecations">Deprecations</a></li> <li><a href="#active-support-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#active-job">Active Job</a> <ul> <li><a href="#active-job-removals">Removals</a></li> <li><a href="#active-job-deprecations">Deprecations</a></li> <li><a href="#active-job-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#action-text">Action Text</a> <ul> <li><a href="#action-text-removals">Removals</a></li> <li><a href="#action-text-deprecations">Deprecations</a></li> <li><a href="#action-text-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#action-mailbox">Action Mailbox</a> <ul> <li><a href="#action-mailbox-removals">Removals</a></li> <li><a href="#action-mailbox-deprecations">Deprecations</a></li> <li><a href="#action-mailbox-notable-changes">Notable changes</a></li> </ul></li> <li><a href="#ruby-on-rails-guides">Ruby on Rails Guides</a> <ul> <li><a href="#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-7-0"><a class="anchorlink" href="#upgrading-to-rails-7-0" data-turbo="false"><span>1.</span> Upgrading to Rails 7.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 6.1 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 7.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-6-1-to-rails-7-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><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/7-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> Remove deprecated <code>config</code> in <code>dbconsole</code>.</li> </ul> <h3 id="railties-deprecations"><a class="anchorlink" href="#railties-deprecations" data-turbo="false"><span>3.2.</span> Deprecations</a></h3><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> Sprockets is now an optional dependency</p><p>The gem <code>rails</code> doesn't depend on <code>sprockets-rails</code> anymore. If your application still needs to use Sprockets, make sure to add <code>sprockets-rails</code> to your Gemfile.</p><div class="interstitial code"> <pre><code class="highlight plaintext">gem "sprockets-rails" </code></pre> <button class="clipboard-button" data-clipboard-text="gem &quot;sprockets-rails&quot; ">Copy</button> </div></li> </ul> <h2 id="action-cable"><a class="anchorlink" href="#action-cable" data-turbo="false"><span>4.</span> Action Cable</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/actioncable/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="action-cable-removals"><a class="anchorlink" href="#action-cable-removals" data-turbo="false"><span>4.1.</span> Removals</a></h3><h3 id="action-cable-deprecations"><a class="anchorlink" href="#action-cable-deprecations" data-turbo="false"><span>4.2.</span> Deprecations</a></h3><h3 id="action-cable-notable-changes"><a class="anchorlink" href="#action-cable-notable-changes" data-turbo="false"><span>4.3.</span> Notable changes</a></h3><h2 id="action-pack"><a class="anchorlink" href="#action-pack" data-turbo="false"><span>5.</span> Action Pack</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-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>5.1.</span> Removals</a></h3> <ul> <li><p> Remove deprecated <code>ActionDispatch::Response.return_only_media_type_on_content_type</code>.</p></li> <li><p> Remove deprecated <code>Rails.config.action_dispatch.hosts_response_app</code>.</p></li> <li><p> Remove deprecated <code>ActionDispatch::SystemTestCase#host!</code>.</p></li> <li><p> Remove deprecated support to passing a path to <code>fixture_file_upload</code> relative to <code>fixture_path</code>.</p></li> </ul> <h3 id="action-pack-deprecations"><a class="anchorlink" href="#action-pack-deprecations" data-turbo="false"><span>5.2.</span> Deprecations</a></h3><h3 id="action-pack-notable-changes"><a class="anchorlink" href="#action-pack-notable-changes" data-turbo="false"><span>5.3.</span> Notable changes</a></h3><h2 id="action-view"><a class="anchorlink" href="#action-view" data-turbo="false"><span>6.</span> Action View</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-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>6.1.</span> Removals</a></h3> <ul> <li> Remove deprecated <code>Rails.config.action_view.raise_on_missing_translations</code>.</li> </ul> <h3 id="action-view-deprecations"><a class="anchorlink" href="#action-view-deprecations" data-turbo="false"><span>6.2.</span> Deprecations</a></h3><h3 id="action-view-notable-changes"><a class="anchorlink" href="#action-view-notable-changes" data-turbo="false"><span>6.3.</span> Notable changes</a></h3> <ul> <li><p> <code>button_to</code> infers HTTP verb [method] from an Active Record object if object is used to build URL</p><div class="interstitial code"> <pre><code class="highlight ruby"><span class="n">button_to</span><span class="p">(</span><span class="s2">"Do a POST"</span><span class="p">,</span> <span class="p">[</span><span class="ss">:do_post_action</span><span class="p">,</span> <span class="no">Workshop</span><span class="p">.</span><span class="nf">find</span><span class="p">(</span><span class="mi">1</span><span class="p">)])</span> <span class="c1"># Before</span> <span class="c1">#=&gt; &lt;input type="hidden" name="_method" value="post" autocomplete="off" /&gt;</span> <span class="c1"># After</span> <span class="c1">#=&gt; &lt;input type="hidden" name="_method" value="patch" autocomplete="off" /&gt;</span> </code></pre> <button class="clipboard-button" data-clipboard-text="button_to(&quot;Do a POST&quot;, [:do_post_action, Workshop.find(1)]) # Before #=> <input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;post&quot; autocomplete=&quot;off&quot; /> # After #=> <input type=&quot;hidden&quot; name=&quot;_method&quot; value=&quot;patch&quot; autocomplete=&quot;off&quot; /> ">Copy</button> </div></li> </ul> <h2 id="action-mailer"><a class="anchorlink" href="#action-mailer" data-turbo="false"><span>7.</span> Action Mailer</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-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>7.1.</span> Removals</a></h3> <ul> <li> Remove deprecated <code>ActionMailer::DeliveryJob</code> and <code>ActionMailer::Parameterized::DeliveryJob</code> in favor of <code>ActionMailer::MailDeliveryJob</code>.</li> </ul> <h3 id="action-mailer-deprecations"><a class="anchorlink" href="#action-mailer-deprecations" data-turbo="false"><span>7.2.</span> Deprecations</a></h3><h3 id="action-mailer-notable-changes"><a class="anchorlink" href="#action-mailer-notable-changes" data-turbo="false"><span>7.3.</span> Notable changes</a></h3><h2 id="active-record"><a class="anchorlink" href="#active-record" data-turbo="false"><span>8.</span> Active Record</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-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>8.1.</span> Removals</a></h3> <ul> <li><p> Remove deprecated <code>database</code> kwarg from <code>connected_to</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Base.allow_unsafe_raw_sql</code>.</p></li> <li><p> Remove deprecated option <code>:spec_name</code> in the <code>configs_for</code> method.</p></li> <li><p> Remove deprecated support to YAML load <code>ActiveRecord::Base</code> instance in the Rails 4.2 and 4.1 formats.</p></li> <li><p> Remove deprecation warning when <code>:interval</code> column is used in PostgreSQL database.</p><p>Now, interval columns will return <code>ActiveSupport::Duration</code> objects instead of strings.</p><p>To keep the old behavior, you can add this line to your model:</p><div class="interstitial code"> <pre><code class="highlight ruby"><span class="n">attribute</span> <span class="ss">:column</span><span class="p">,</span> <span class="ss">:string</span> </code></pre> <button class="clipboard-button" data-clipboard-text="attribute :column, :string ">Copy</button> </div></li> <li><p> Remove deprecated support to resolve connection using <code>"primary"</code> as connection specification name.</p></li> <li><p> Remove deprecated support to quote <code>ActiveRecord::Base</code> objects.</p></li> <li><p> Remove deprecated support to type cast to database values <code>ActiveRecord::Base</code> objects.</p></li> <li><p> Remove deprecated support to pass a column to <code>type_cast</code>.</p></li> <li><p> Remove deprecated <code>DatabaseConfig#config</code> method.</p></li> <li><p> Remove deprecated rake tasks:</p> <ul> <li><code>db:schema:load_if_ruby</code></li> <li><code>db:structure:dump</code></li> <li><code>db:structure:load</code></li> <li><code>db:structure:load_if_sql</code></li> <li><code>db:structure:dump:#{name}</code></li> <li><code>db:structure:load:#{name}</code></li> <li><code>db:test:load_structure</code></li> <li><code>db:test:load_structure:#{name}</code></li> </ul></li> <li><p> Remove deprecated support to <code>Model.reorder(nil).first</code> to search using non-deterministic order.</p></li> <li><p> Remove deprecated <code>environment</code> and <code>name</code> arguments from <code>Tasks::DatabaseTasks.schema_up_to_date?</code>.</p></li> <li><p> Remove deprecated <code>Tasks::DatabaseTasks.dump_filename</code>.</p></li> <li><p> Remove deprecated <code>Tasks::DatabaseTasks.schema_file</code>.</p></li> <li><p> Remove deprecated <code>Tasks::DatabaseTasks.spec</code>.</p></li> <li><p> Remove deprecated <code>Tasks::DatabaseTasks.current_config</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Connection#allowed_index_name_length</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Connection#in_clause_length</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::DatabaseConfigurations::DatabaseConfig#spec_name</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Base.connection_config</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Base.arel_attribute</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Base.configurations.default_hash</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Base.configurations.to_h</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Result#map!</code> and <code>ActiveRecord::Result#collect!</code>.</p></li> <li><p> Remove deprecated <code>ActiveRecord::Base#remove_connection</code>.</p></li> </ul> <h3 id="active-record-deprecations"><a class="anchorlink" href="#active-record-deprecations" data-turbo="false"><span>8.2.</span> Deprecations</a></h3> <ul> <li> Deprecated <code>Tasks::DatabaseTasks.schema_file_type</code>.</li> </ul> <h3 id="active-record-notable-changes"><a class="anchorlink" href="#active-record-notable-changes" data-turbo="false"><span>8.3.</span> Notable changes</a></h3> <ul> <li><p> Rollback transactions when the block returns earlier than expected.</p><p>Before this change, when a transaction block returned early, the transaction would be committed.</p><p>The problem is that timeouts triggered inside the transaction block was also making the incomplete transaction to be committed, so in order to avoid this mistake, the transaction block is rolled back.</p></li> <li><p> Merging conditions on the same column no longer maintain both conditions, and will be consistently replaced by the latter condition.</p><div class="interstitial code"> <pre><code class="highlight ruby"><span class="c1"># Rails 6.1 (IN clause is replaced by merger side equality condition)</span> <span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="p">[</span><span class="n">david</span><span class="p">.</span><span class="nf">id</span><span class="p">,</span> <span class="n">mary</span><span class="p">.</span><span class="nf">id</span><span class="p">]).</span><span class="nf">merge</span><span class="p">(</span><span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">bob</span><span class="p">))</span> <span class="c1"># =&gt; [bob]</span> <span class="c1"># Rails 6.1 (both conflict conditions exists, deprecated)</span> <span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">david</span><span class="p">.</span><span class="nf">id</span><span class="o">..</span><span class="n">mary</span><span class="p">.</span><span class="nf">id</span><span class="p">).</span><span class="nf">merge</span><span class="p">(</span><span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">bob</span><span class="p">))</span> <span class="c1"># =&gt; []</span> <span class="c1"># Rails 6.1 with rewhere to migrate to Rails 7.0's behavior</span> <span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">david</span><span class="p">.</span><span class="nf">id</span><span class="o">..</span><span class="n">mary</span><span class="p">.</span><span class="nf">id</span><span class="p">).</span><span class="nf">merge</span><span class="p">(</span><span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">bob</span><span class="p">),</span> <span class="ss">rewhere: </span><span class="kp">true</span><span class="p">)</span> <span class="c1"># =&gt; [bob]</span> <span class="c1"># Rails 7.0 (same behavior with IN clause, mergee side condition is consistently replaced)</span> <span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="p">[</span><span class="n">david</span><span class="p">.</span><span class="nf">id</span><span class="p">,</span> <span class="n">mary</span><span class="p">.</span><span class="nf">id</span><span class="p">]).</span><span class="nf">merge</span><span class="p">(</span><span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">bob</span><span class="p">))</span> <span class="c1"># =&gt; [bob]</span> <span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">david</span><span class="p">.</span><span class="nf">id</span><span class="o">..</span><span class="n">mary</span><span class="p">.</span><span class="nf">id</span><span class="p">).</span><span class="nf">merge</span><span class="p">(</span><span class="no">Author</span><span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">id: </span><span class="n">bob</span><span class="p">))</span> <span class="c1"># =&gt; [bob]</span> </code></pre> <button class="clipboard-button" data-clipboard-text="# Rails 6.1 (IN clause is replaced by merger side equality condition) Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob] # Rails 6.1 (both conflict conditions exists, deprecated) Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => [] # Rails 6.1 with rewhere to migrate to Rails 7.0's behavior Author.where(id: david.id..mary.id).merge(Author.where(id: bob), rewhere: true) # => [bob] # Rails 7.0 (same behavior with IN clause, mergee side condition is consistently replaced) Author.where(id: [david.id, mary.id]).merge(Author.where(id: bob)) # => [bob] Author.where(id: david.id..mary.id).merge(Author.where(id: bob)) # => [bob] ">Copy</button> </div></li> </ul> <h2 id="active-storage"><a class="anchorlink" href="#active-storage" data-turbo="false"><span>9.</span> Active Storage</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/activestorage/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="active-storage-removals"><a class="anchorlink" href="#active-storage-removals" data-turbo="false"><span>9.1.</span> Removals</a></h3><h3 id="active-storage-deprecations"><a class="anchorlink" href="#active-storage-deprecations" data-turbo="false"><span>9.2.</span> Deprecations</a></h3><h3 id="active-storage-notable-changes"><a class="anchorlink" href="#active-storage-notable-changes" data-turbo="false"><span>9.3.</span> Notable changes</a></h3><h2 id="active-model"><a class="anchorlink" href="#active-model" data-turbo="false"><span>10.</span> Active Model</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-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>10.1.</span> Removals</a></h3> <ul> <li><p> Remove deprecated enumeration of <code>ActiveModel::Errors</code> instances as a Hash.</p></li> <li><p> Remove deprecated <code>ActiveModel::Errors#to_h</code>.</p></li> <li><p> Remove deprecated <code>ActiveModel::Errors#slice!</code>.</p></li> <li><p> Remove deprecated <code>ActiveModel::Errors#values</code>.</p></li> <li><p> Remove deprecated <code>ActiveModel::Errors#keys</code>.</p></li> <li><p> Remove deprecated <code>ActiveModel::Errors#to_xml</code>.</p></li> <li><p> Remove deprecated support concat errors to <code>ActiveModel::Errors#messages</code>.</p></li> <li><p> Remove deprecated support to <code>clear</code> errors from <code>ActiveModel::Errors#messages</code>.</p></li> <li><p> Remove deprecated support to <code>delete</code> errors from <code>ActiveModel::Errors#messages</code>.</p></li> <li><p> Remove deprecated support to use <code>[]=</code> in <code>ActiveModel::Errors#messages</code>.</p></li> <li><p> Remove support to Marshal and YAML load Rails 5.x error format.</p></li> <li><p> Remove support to Marshal load Rails 5.x <code>ActiveModel::AttributeSet</code> format.</p></li> </ul> <h3 id="active-model-deprecations"><a class="anchorlink" href="#active-model-deprecations" data-turbo="false"><span>10.2.</span> Deprecations</a></h3><h3 id="active-model-notable-changes"><a class="anchorlink" href="#active-model-notable-changes" data-turbo="false"><span>10.3.</span> Notable changes</a></h3><h2 id="active-support"><a class="anchorlink" href="#active-support" data-turbo="false"><span>11.</span> Active Support</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/activesupport/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="active-support-removals"><a class="anchorlink" href="#active-support-removals" data-turbo="false"><span>11.1.</span> Removals</a></h3> <ul> <li><p> Remove deprecated <code>config.active_support.use_sha1_digests</code>.</p></li> <li><p> Remove deprecated <code>URI.parser</code>.</p></li> <li><p> Remove deprecated support to use <code>Range#include?</code> to check the inclusion of a value in a date time range is deprecated.</p></li> <li><p> Remove deprecated <code>ActiveSupport::Multibyte::Unicode.default_normalization_form</code>.</p></li> </ul> <h3 id="active-support-deprecations"><a class="anchorlink" href="#active-support-deprecations" data-turbo="false"><span>11.2.</span> Deprecations</a></h3> <ul> <li><p> Deprecate passing a format to <code>#to_s</code> in favor of <code>#to_fs</code> in <code>Array</code>, <code>Range</code>, <code>Date</code>, <code>DateTime</code>, <code>Time</code>, <code>BigDecimal</code>, <code>Float</code> and, <code>Integer</code>.</p><p>This deprecation is to allow Rails application to take advantage of a Ruby 3.1 <a href="https://github.com/ruby/ruby/commit/b08dacfea39ad8da3f1fd7fdd0e4538cc892ec44">optimization</a> that makes interpolation of some types of objects faster.</p><p>New applications will not have the <code>#to_s</code> method overridden on those classes, existing applications can use <code>config.active_support.disable_to_s_conversion</code>.</p></li> </ul> <h3 id="active-support-notable-changes"><a class="anchorlink" href="#active-support-notable-changes" data-turbo="false"><span>11.3.</span> Notable changes</a></h3><h2 id="active-job"><a class="anchorlink" href="#active-job" data-turbo="false"><span>12.</span> Active Job</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/activejob/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="active-job-removals"><a class="anchorlink" href="#active-job-removals" data-turbo="false"><span>12.1.</span> Removals</a></h3> <ul> <li><p> Removed deprecated behavior that was not halting <code>after_enqueue</code>/<code>after_perform</code> callbacks when a previous callback was halted with <code>throw :abort</code>.</p></li> <li><p> Remove deprecated <code>:return_false_on_aborted_enqueue</code> option.</p></li> </ul> <h3 id="active-job-deprecations"><a class="anchorlink" href="#active-job-deprecations" data-turbo="false"><span>12.2.</span> Deprecations</a></h3> <ul> <li> Deprecated <code>Rails.config.active_job.skip_after_callbacks_if_terminated</code>.</li> </ul> <h3 id="active-job-notable-changes"><a class="anchorlink" href="#active-job-notable-changes" data-turbo="false"><span>12.3.</span> Notable changes</a></h3><h2 id="action-text"><a class="anchorlink" href="#action-text" data-turbo="false"><span>13.</span> Action Text</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/actiontext/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="action-text-removals"><a class="anchorlink" href="#action-text-removals" data-turbo="false"><span>13.1.</span> Removals</a></h3><h3 id="action-text-deprecations"><a class="anchorlink" href="#action-text-deprecations" data-turbo="false"><span>13.2.</span> Deprecations</a></h3><h3 id="action-text-notable-changes"><a class="anchorlink" href="#action-text-notable-changes" data-turbo="false"><span>13.3.</span> Notable changes</a></h3><h2 id="action-mailbox"><a class="anchorlink" href="#action-mailbox" data-turbo="false"><span>14.</span> Action Mailbox</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/actionmailbox/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="action-mailbox-removals"><a class="anchorlink" href="#action-mailbox-removals" data-turbo="false"><span>14.1.</span> Removals</a></h3> <ul> <li><p> Removed deprecated <code>Rails.application.credentials.action_mailbox.mailgun_api_key</code>.</p></li> <li><p> Removed deprecated environment variable <code>MAILGUN_INGRESS_API_KEY</code>.</p></li> </ul> <h3 id="action-mailbox-deprecations"><a class="anchorlink" href="#action-mailbox-deprecations" data-turbo="false"><span>14.2.</span> Deprecations</a></h3><h3 id="action-mailbox-notable-changes"><a class="anchorlink" href="#action-mailbox-notable-changes" data-turbo="false"><span>14.3.</span> Notable changes</a></h3><h2 id="ruby-on-rails-guides"><a class="anchorlink" href="#ruby-on-rails-guides" data-turbo="false"><span>15.</span> Ruby on Rails Guides</a></h2><p>Please refer to the <a href="https://github.com/rails/rails/blob/7-0-stable/guides/CHANGELOG.md">Changelog</a> for detailed changes.</p><h3 id="notable-changes"><a class="anchorlink" href="#notable-changes" data-turbo="false"><span>15.1.</span> Notable changes</a></h3><h2 id="credits"><a class="anchorlink" href="#credits" data-turbo="false"><span>16.</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