升级Rails 5.1至5.2:new_framework_defaults_5_2.rb文件该如何处理?
new_framework_defaults_5_2.rb Hey there! Let's break down all your questions about that auto-generated initializer file from your Rails upgrade:
1. Does commenting all lines mean all new defaults are enabled?
Absolutely! The new_framework_defaults_5_2.rb file is built to help you transition to Rails 5.2's settings gradually. Every commented line in this file represents the new default value that Rails 5.2 is already using for your app. If you wanted to revert a specific setting to the old Rails 5.1 behavior, you'd uncomment that line and adjust its value (like switching true to false). Since all lines are commented right now, your app is fully running on Rails 5.2's default configurations.
2. Can I delete this file?
You can delete it, but I'd suggest keeping it around for a bit longer. It acts as a quick reference for all the configuration changes between 5.1 and 5.2—if you hit unexpected behavior later, you can instantly check which new default might be causing the issue. Once you've confirmed your app is stable and you don't need to reference or tweak any of these settings anymore, feel free to delete it safely.
3. If I run into errors later, are the values in the file the new defaults? Should I uncomment and adjust them?
Yep, the values in the commented lines are exactly the new defaults your app is relying on. If an error is traced back to a specific new configuration, you can uncomment that line and modify it to match the old Rails 5.1 behavior (the comments usually note what the old value was too). This lets you temporarily revert that setting while you fix whatever part of your app isn't compatible with the new default. Once you've updated your code to work with the new setting, you can re-comment the line or remove it entirely.
内容的提问来源于stack exchange,提问作者telzul

