For issue filed at rails/rails#46625
- ./bin/rails db:reset
- ./bin/rails runner "Car.create!(title: 'honda')"
- ./bin/rails runner "Car"
This produces a NameError exception "uninitialized constant Car".
If you want to see the whole backtrace, try:
./bin/rails runner ./scripts/reference_car.rb
This would not have happened in a Rails 6.1 app -- maybe it's got something to do with autoloading in changes in Rails 7 maybe?
Same app in Rails 6.1 demonstrating exception is not raised: https://github.com/jrochkind/rails61_sti_bug_non_repro