Has_one belongs_to association key in plural. (KeyError) key not found

i have two schemas Company companies and ClaimedPage claimed_pages;

table(:companies) do
      add :claimed_page_id, references(:claimed_pages, on_replace: :update)

belongs_to :claimed_page, ClaimedPage, foreign_key: claimed_page_id
has_one :company, Company, foreign_key: claimed_page_id

While preloading Company with ClaimedPage i am getting
(KeyError) key :claimed_pages not found where the key is actually :claimed_page

How can I rename it to claimed_page?

1 Like