# Warning in Rails Console Factory Bot Doesn't Seem to reload! Correctly

DevFeed: [Warning in Rails Console Factory Bot Doesn't Seem to reload! Correctly](<https://devfeed.tech/articles/warning-in-rails-console-factory-bot-doesn-t-seem-to-reload-correctly-28281.md>)

Original publisher: [Read original article](<http://fuzzyblog.io/blog/rails/2022/06/08/warning-in-rails-console-factory-bot-doesn-t-seem-to-reload-correctly.html>)

Author: Fuzzygroup

Published: 2022-06-08T12:13:00Z

Content type: tutorial

Language: en

Sources: [Scott Johnson](<https://devfeed.tech/sources/scott-johnson.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [code](<https://devfeed.tech/tags/code.md>), [development](<https://devfeed.tech/tags/development.md>), [factorybot](<https://devfeed.tech/tags/factorybot.md>), [rails](<https://devfeed.tech/tags/rails.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [test](<https://devfeed.tech/tags/test.md>)

## AI overview

A developer documents a Rails console issue where FactoryBot object creation continued to fail after model changes and a reload!. Exiting and restarting the console resolved the behavior; the original error was caused by a missing belongs_to block in the model.

## Source excerpt

I'm actively engaged in greenfield development once again and I'm learning / relearning things that I likely have known in the past. I don't know if this is a known issue, a bug or maybe a design choice. Either way, I found it useful to know this so I thought it was useful to document it. I spend a lot of time in rails console (thank you Jared for beating this into me a thousand, thousand years ago; hope you are well) and reload! normally works pretty damn well but this one caught me hard. Take a look at this back trace link = FactoryBot::create(:link) TRANSACTION (0.1ms) BEGIN Account Create (0.2ms) INSERT INTO "accounts" ("email", "status", "role") VALUES ($1, $2, $3) RETURNING "id" [["email", "howard@watsica.com"], ["status", "verified"], ["role", "customer"]] Account::PasswordHash Create (0.2ms) INSERT INTO "account_password_hashes" ("id", "password_hash") VALUES ($1, $2) RETURNING "id" [["id", 63], ["password_hash", "[FILTERED]"]] TRANSACTION (0.5ms) COMMIT /Users/sjohnson/.rvm/gems/ruby-3.0.0/gems/activemodel-7.0.3/lib/active_model/attribute_methods.rb:458:in `method_missing': undefined method `account=' for #<Link id: nil, created_at: nil, updated_at: nil, date_created_at: nil, account_id: nil, team_id: nil, link_type_id: nil, active: true, url: "https://www.example.com/", name: "Cartazzi App on development", project_id: nil, code_environment_id: nil> (NoMethodError) Did you mean? account_id= 3.0.0 :014 > reload! Reloading... true 3.0.0 :015 > link = FactoryBot::create(:link) TRANSACTION (0.1ms) BEGIN Account Create (0.3ms) INSERT INTO "accounts" ("email", "status", "role") VALUES ($1, $2, $3) RETURNING "id" [["email", "chu_carter@schaden.name"], ["status", "verified"], ["role", "customer"]] Account::PasswordHash Create (0.3ms) INSERT INTO "account_password_hashes" ("id", "password_hash") VALUES ($1, $2) RETURNING "id" [["id", 64], ["password_hash", "[FILTERED]"]] TRANSACTION (0.5ms) COMMIT /Users/sjohnson/.rvm/gems/ruby-3.0.0/gems/activemodel-7.0.3/lib/activ