I have a configuration in .irbrc that would auto connect to the database when loading rails console:
# ~/.irbrc
if defined? Rails
# connect to db to avoid seeing `User (call 'User.connection' to establish a connection)`
ActiveSupport.on_load(:active_record) do
connection
end
end
In rails 8 this doesn't work anymore:
>> ActiveRecord::Base.connection
=> #<ActiveRecord::ConnectionAdapters::SQLite3Adapter:0x00000000007810 ...>
# Rails 7
>> User
=> User(id: integer, email: string, created_at: datetime, updated_at: datetime)
# Rails 8
>> User
=> User (call 'User.load_schema' to load schema informations)
I've tried calling ActiveRecord::Base.load_schema, but table name is required:
>> ActiveRecord::Base.load_schema
(stackoverflow):1:in '<main>': ActiveRecord::Base has no table configured. Set one with ActiveRecord::Base.table_name= (ActiveRecord::TableNotSpecified)