- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
-
In
zeitwerkmode, setup theonceautoloader first, and themainautoloader after it. This order plays better with shared namespaces.Xavier Noria
-
Handle paths with spaces when editing credentials.
Alex Ghiculescu
-
Support Psych 4 when loading secrets.
Nat Morcos
- No changes.
- No changes.
- No changes.
- No changes.
-
Allow localhost with a port by default in development
[Fixes: #43864]
- No changes.
- No changes.
-
Fix compatibility with
psych >= 4.Starting in Psych 4.0.0
YAML.loadbehaves likeYAML.safe_load. To preserve compatibilityRails.application.config_fornow usesYAML.unsafe_loadif available.Jean Boussier
-
Ensure
Rails.application.config_foralways cast hashes toActiveSupport::OrderedOptions.Jean Boussier
-
Fix create migration generator with
--pretendoption.euxx
- No changes.
- No changes.
- No changes.
- No changes.
- No changes.
-
Allow spaces in path to Yarn binstub and only run on precompile if needed.
Markus Doits
-
Populate ARGV for app template.
Fixes #40945.
Jonathan Hefner
-
Added
Railtie#serverhook called when Rails starts a server. This is useful in case your application or a library needs to run another process next to the Rails server. This is quite common in development for instance to run the Webpack or the React server.It can be used like this:
class MyRailtie < Rails::Railtie server do WebpackServer.run end end
Edouard Chin
-
Remove deprecated
rake dev:cachetasks.Rafael Mendonça França
-
Remove deprecated
rake routestasks.Rafael Mendonça França
-
Remove deprecated
rake initializerstasks.Rafael Mendonça França
-
Remove deprecated support for using the
HOSTenvironment variable to specify the server IP.Rafael Mendonça França
-
Remove deprecated
serverargument from the rails server command.Rafael Mendonça França
-
Remove deprecated
SOURCE_ANNOTATION_DIRECTORIESenvironment variable support fromrails notes.Rafael Mendonça França
-
Remove deprecated
connectionoption in therails dbconsolecommand.Rafael Mendonça França
-
Remove depreated
rake notestasks.Rafael Mendonça França
-
Return a 405 Method Not Allowed response when a request uses an unknown HTTP method.
Fixes #38998.
Loren Norman
-
Make railsrc file location xdg-specification compliant
rails newwill now look for the defaultrailsrcfile at$XDG_CONFIG_HOME/rails/railsrc(or~/.config/rails/railsrcifXDG_CONFIG_HOMEis not set). If this file does not exist,rails newwill fall back to~/.railsrc.The fallback behaviour means this does not cause any breaking changes.
Nick Wolf
-
Change the default logging level from :debug to :info to avoid inadvertent exposure of personally identifiable information (PII) in production environments.
Eric M. Payne
-
Automatically generate abstract class when using multiple databases.
When generating a scaffold for a multiple database application, Rails will now automatically generate the abstract class for the database when the database argument is passed. This abstract class will include the connection information for the writing configuration and any models generated for that database will automatically inherit from the abstract class.
Usage:
$ bin/rails generate scaffold Pet name:string --database=animals
Will create an abstract class for the animals connection.
class AnimalsRecord < ApplicationRecord self.abstract_class = true connects_to database: { writing: :animals } end
And generate a
Petmodel that inherits from the newAnimalsRecord:class Pet < AnimalsRecord end
If you already have an abstract class and it follows a different pattern than Rails defaults, you can pass a parent class with the database argument.
$ bin/rails generate scaffold Pet name:string --database=animals --parent=SecondaryBase
This will ensure the model inherits from the
SecondaryBaseparent instead ofAnimalsRecordclass Pet < SecondaryBase end
Eileen M. Uchitelle, John Crepezzi
-
Accept params from url to prepopulate the Inbound Emails form in Rails conductor.
Chris Oliver
-
Create a new rails app using a minimal stack.
rails new cool_app --minimalAll the following are excluded from your minimal stack:
- action_cable
- action_mailbox
- action_mailer
- action_text
- active_job
- active_storage
- bootsnap
- jbuilder
- spring
- system_tests
- turbolinks
- webpack
Haroon Ahmed, DHH
-
Add default ENV variable option with BACKTRACE to turn off backtrace cleaning when debugging framework code in the generated config/initializers/backtrace_silencers.rb.
BACKTRACE=1 ./bin/rails runner "MyClass.perform"DHH
-
The autoloading guide for Zeitwerk mode documents how to autoload classes during application boot in a safe way.
Haroon Ahmed, Xavier Noria
-
The
classicautoloader starts its deprecation cycle.New Rails projects are strongly discouraged from using
classic, and we recommend that existing projects running onclassicswitch tozeitwerkmode when upgrading. Please check the Upgrading Ruby on Rails guide for tips.Xavier Noria
-
Adds
rails test:allfor running all tests in the test directory.This runs all test files in the test directory, including system tests.
Niklas Häusele
-
Add
config.generators.after_generatefor processing to generated files.Register a callback that will get called right after generators has finished.
Yuji Yaginuma
-
Make test file patterns configurable via Environment variables
This makes test file patterns configurable via two environment variables:
DEFAULT_TEST, to configure files to test, andDEFAULT_TEST_EXCLUDE, to configure files to exclude from testing.These values were hardcoded before, which made it difficult to add new categories of tests that should not be executed by default (e.g: smoke tests).
Jorge Manrubia
-
No longer include
rake rdoctask when generating plugins.To generate docs, use the
rdoc libcommand instead.Jonathan Hefner
-
Allow relative paths with trailing slashes to be passed to
rails test.Eugene Kenny
-
Add
rack-mini-profilergem to the defaultGemfile.rack-mini-profilerdisplays performance information such as SQL time and flame graphs. It's enabled by default in development environment, but can be enabled in production as well. See the gem README for information on how to enable it in production.Osama Sayegh
-
rails statswill now count TypeScript files toward JavaScript stats.Joshua Cody
-
Run
git initwhen generating plugins.Opt out with
--skip-git.OKURA Masafumi
-
Add benchmark generator.
Introduce benchmark generator to benchmark Rails applications.
rails generate benchmark opt_compareThis creates a benchmark file that uses
benchmark-ips. By default, two code blocks can be benchmarked using thebeforeandafterreports.You can run the generated benchmark file using:
ruby script/benchmarks/opt_compare.rbKevin Jalbert, Gannon McGibbon
-
Cache compiled view templates when running tests by default.
When generating a new app without
--skip-spring, caching classes is disabled inenvironments/test.rb. This implicitly disables caching view templates too. This change will enable view template caching by adding this to the generatedenvironments/test.rb:config.action_view.cache_template_loading = true
Jorge Manrubia
-
Introduce middleware move operations.
With this change, you no longer need to delete and reinsert a middleware to move it from one place to another in the stack:
config.middleware.move_before ActionDispatch::Flash, Magical::Unicorns
This will move the
Magical::Unicornsmiddleware beforeActionDispatch::Flash. You can also move it after with:config.middleware.move_after ActionDispatch::Flash, Magical::Unicorns
Genadi Samokovarov
-
Generators that inherit from NamedBase respect
--forceoption.Josh Brody
-
Allow configuration of eager_load behaviour for rake environment:
config.rake_eager_loadDefaults to
falseas per previous behaviour.Thierry Joyal
-
Ensure Rails migration generator respects system-wide primary key config.
When rails is configured to use a specific primary key type:
config.generators do |g| g.orm :active_record, primary_key_type: :uuid end
Previously:
$ bin/rails g migration add_location_to_users location:references
The references line in the migration would not have
type: :uuid. This change causes the type to be applied appropriately.Louis-Michel Couture, Dermot Haughey
-
Deprecate
Rails::DBConsole#config.Rails::DBConsole#configis deprecated without replacement. UseRails::DBConsole.db_config.configuration_hashinstead.Eileen M. Uchitelle, John Crepezzi
-
Rails.application.config_formerges shared configuration deeply.# config/example.yml shared: foo: bar: baz: 1 development: foo: bar: qux: 2
# Previously Rails.application.config_for(:example)[:foo][:bar] #=> { qux: 2 } # Now Rails.application.config_for(:example)[:foo][:bar] #=> { baz: 1, qux: 2 }
Yuhei Kiriyama
-
Remove access to values in nested hashes returned by
Rails.application.config_forvia String keys.# config/example.yml development: options: key: value
Rails.application.config_for(:example).options
This used to return a Hash on which you could access values with String keys. This was deprecated in 6.0, and now doesn't work anymore.
Étienne Barrié
-
Configuration files for environments (
config/environments/*.rb) are now able to modifyautoload_paths,autoload_once_paths, andeager_load_paths.As a consequence, applications cannot autoload within those files. Before, they technically could, but changes in autoloaded classes or modules had no effect anyway in the configuration because reloading does not reboot.
Ways to use application code in these files:
-
Define early in the boot process a class that is not reloadable, from which the application takes configuration values that get passed to the framework.
# In config/application.rb, for example. require "#{Rails.root}/lib/my_app/config" # In config/environments/development.rb, for example. config.foo = MyApp::Config.foo
-
If the class has to be reloadable, then wrap the configuration code in a
to_prepareblock:config.to_prepare do config.foo = MyModel.foo end
That assigns the latest
MyModel.footoconfig.foowhen the application boots, and each time there is a reload. But whether that has an effect or not depends on the configuration point, since it is not uncommon for engines to read the application configuration during initialization and set their own state from them. That process happens only on boot, not on reloads, and if that is howconfig.fooworked, resetting it would have no effect in the state of the engine.
Allen Hsu & Xavier Noria
-
-
Support using environment variable to set pidfile.
Ben Thorner
Please check 6-0-stable for previous changes.