[Ruby] Correspondence when call’Hoge.connection’ to establish a connection appears on rails c

less than 1 minute read

Problem

[1] pry(main)> Hoge
=> Gravure::Series::Publics (call'Hoge.connection' to establish a connection)

Solution

[2] pry(main)> Hoge.clear_cache!
    [writing](3.7ms)SETNAMESutf8mb4,@@SESSION.sql_mode=CONCAT(CONCAT(@@sql_mode,',STRICT_ALL_TABLES'),',NO_AUTO_VALUE_ON_ZERO'), @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_timeout = 2147483
=> nil

Solved by running .clear_cache!