Skip to content

Conversation

baonguyenNava
Copy link

@baonguyenNava baonguyenNava commented Sep 24, 2025

Major version upgrade:

release notes - See for full list of deprecations.

Then main deprecations we may need to address are in the views. Otherwise, most of the deprecations are configs.

[6.1. Removals](https://guides.rubyonrails.org/8_0_release_notes.html#action-view-removals)
Remove deprecated support to passing nil to the model: argument of form_with.

Remove deprecated support to passing a content to void tag elements on the tag builder.

Resoles #71

New framework defaults and configs below

# Be sure to restart your server when you modify this file.
#
# This file eases your Rails 8.0 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults` to `8.0`.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html

###
# Specifies whether `to_time` methods preserve the UTC offset of their receivers or preserves the timezone.
# If set to `:zone`, `to_time` methods will use the timezone of their receivers.
# If set to `:offset`, `to_time` methods will use the UTC offset.
# If `false`, `to_time` methods will convert to the local system UTC offset instead.
#++
# Rails.application.config.active_support.to_time_preserves_timezone = :zone

###
# When both `If-Modified-Since` and `If-None-Match` are provided by the client
# only consider `If-None-Match` as specified by RFC 7232 Section 6.
# If set to `false` both conditions need to be satisfied.
#++
# Rails.application.config.action_dispatch.strict_freshness = true

###
# Set `Regexp.timeout` to `1`s by default to improve security over Regexp Denial-of-Service attacks.
#++
# Regexp.timeout = 1

@@ -1,5 +1,5 @@
module ApplicationHelper
def us_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling form_with with model: nil is deprecated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we want to create a form without a model like a search bar?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can revise it to remove the argument in model is nil

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should update the default to false to match upstream. And let anywhere currently calling explicitly with model: nil break (fixing any current usage in template-application-rails in this PR of course).

Suggested change
def us_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
def us_form_with(model: false, scope: nil, url: nil, format: nil, **options, &block)

Ideally we would specify this as a type, so static checking would catch the callsites, but Ruby....

@baonguyenNava baonguyenNava marked this pull request as ready for review September 24, 2025 19:58
@baonguyenNava baonguyenNava changed the title Baonguyen/rails 8 upgrade Upgrade to Rails 8.0.3 Sep 24, 2025

# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.2
config.load_defaults 8.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any config changes worth calling out?

Did we run rails app:update?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I did. Nothing big, but I can leave commentary in the PR in case someone wants to change something downstream.

@@ -1,5 +1,5 @@
module ApplicationHelper
def us_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should update the default to false to match upstream. And let anywhere currently calling explicitly with model: nil break (fixing any current usage in template-application-rails in this PR of course).

Suggested change
def us_form_with(model: nil, scope: nil, url: nil, format: nil, **options, &block)
def us_form_with(model: false, scope: nil, url: nil, format: nil, **options, &block)

Ideally we would specify this as a type, so static checking would catch the callsites, but Ruby....

@doshitan doshitan mentioned this pull request Sep 25, 2025
@lorenyu
Copy link
Contributor

lorenyu commented Sep 25, 2025

@baonguyenNava if you add "Resolves #71" to the Description it'll automatically mark that ticket as done when this PR is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants