Skip to content

Change active_model.i18n_customize_full_message default from false to true#50406

Open
stevepolitodesign wants to merge 3 commits intorails:mainfrom
stevepolitodesign:sp-i18n_customize_full_message-change-default
Open

Change active_model.i18n_customize_full_message default from false to true#50406
stevepolitodesign wants to merge 3 commits intorails:mainfrom
stevepolitodesign:sp-i18n_customize_full_message-change-default

Conversation

@stevepolitodesign
Copy link
Contributor

@stevepolitodesign stevepolitodesign commented Dec 20, 2023

Motivation / Background

Follow-up to #32956 and #35789

The introduction of this configuration in #32956 stated that:

The goal of this PR is to make it easier for an app to transition from
a #{attribute} #{message} to a #{message}, full_message error format.

However, because the default value was set to false, this feature was difficult to discover.

Moving forward, consumers will be able to override the format of an individual attribute by default.

en:
  activemodel: # or activerecord:
    errors:
      models:
        person:
          # Override the format for all Person attributes:
          format: "Invalid %{attribute} (%{message})"
          attributes:
            age:
              # Override the format for the age attribute:
              format: "%{message}"
              blank: "Please fill in your %{attribute}"

Detail

config.active_model.i18n_customize_full_message defaults to true for config.load_defaults 7.2 and above

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

…` to `true`

Follow-up to rails#32956 and rails#35789

The introduction of this configuration in rails#32956 stated that:

> The goal of this PR is to make it easier for an app to transition from
a #{attribute} #{message} to a #{message}, full_message error format.

However, because the default value was set to `false`, this feature was
difficult to discover.

`config.active_model.i18n_customize_full_message` defaults to `true` for
`config.load_defaults 7.2` and above.
@stevepolitodesign stevepolitodesign force-pushed the sp-i18n_customize_full_message-change-default branch from 3e7e750 to f120711 Compare April 1, 2024 11:24
@stevepolitodesign
Copy link
Contributor Author

@sikachu tagging you since you merged #32956

stevepolitodesign pushed a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342
stevepolitodesign pushed a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342
stevepolitodesign pushed a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342
stevepolitodesign pushed a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342
stevepolitodesign pushed a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342
stevepolitodesign pushed a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this pull request Apr 5, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342

Co-authored-by: Steve Polito <stevepolito@hey.com>
stevepolitodesign added a commit to thoughtbot/suspenders that referenced this pull request May 10, 2024
Creates generator to configure the development environment. Keeps parity
with Rails as much as possible in an effort to avoid drift with Rails
standards.

It's possible a future release of Rails will alleviate us from having to
do the following:

- enable `active_model.i18n_customize_full_message` which is being
  addressed in [#50406][]
- enable `active_record.query_log_tags_enabled` which is being addressed
  in [#51342][]

[#50406]: rails/rails#50406
[#51342]: rails/rails#51342

Co-authored-by: Steve Polito <stevepolito@hey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant