Skip to content

Stop accessing class variables directly by using the default option of mattr_accessor#24

Merged
willnet merged 2 commits intomainfrom
use-mattr-accessor-default
Dec 23, 2025
Merged

Stop accessing class variables directly by using the default option of mattr_accessor#24
willnet merged 2 commits intomainfrom
use-mattr-accessor-default

Conversation

@willnet
Copy link
Owner

@willnet willnet commented Dec 23, 2025

Use the default option available since Rails 5.2. mattr_accessor internally accesses class variables, but this is not obvious and makes seed-do.rb harder to understand. Using the default option is more intuitive and easier to read.

ref: Implement mattr_acessor :default option · rails/rails@a5b0c60

…f mattr_accessor

Use the default option available since Rails 5.2. mattr_accessor internally accesses class variables, but this is not obvious and makes seed-do.rb harder to understand. Using the default option is more intuitive and easier to read.

ref: [Implement mattr_acessor :default option · rails/rails@a5b0c60](rails/rails@a5b0c60)
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the code by using the default option of mattr_accessor (available since Rails 5.2) instead of directly accessing class variables. This change improves code readability and maintainability by making the default values more explicit and reducing the number of lines needed to define module attributes with defaults.

Key changes:

  • Refactored quiet attribute to use inline default value
  • Refactored fixture_paths attribute to use inline default value

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

fix typo

Co-authored-by: Copilot <[email protected]>
@willnet willnet merged commit 9de4b24 into main Dec 23, 2025
31 checks passed
@willnet willnet deleted the use-mattr-accessor-default branch December 23, 2025 01:28
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.

1 participant