Skip table reset for classes without table names
What does this MR do and why?
Change our migration spec helper so that we don't call reset_column_information
on models that don't have table names.
Sometimes in specs we create anonymous ActiveRecord classes that don't define a table name. These classes can't actually be used to query the schema or data and we actually have nothing to reset here.
Example, in Rails 7 console:
[1] pry(main)> Class.new(ActiveRecord::Base).reset_column_information
ArgumentError: Class name cannot be blank. You need to supply a name argument when anonymous class given
from /Users/work/.asdf/installs/ruby/3.0.5/lib/ruby/gems/3.0.0/gems/activemodel-7.0.4.2/lib/active_model/naming.rb:169:in `initialize'
In Rails 6, this does not raise an exception and I think it does nothing.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Heinrich Lee Yu