Custom field to the Devise user doesn't work in seeds.rb file

This is the error I get when running seeds.rb

ActiveModel::UnknownAttributeError: unknown 
attribute 'extra_cash' for User. 
(ActiveModel::UnknownAttributeError)
    raise UnknownAttributeError.new(self, k.to_s)

My seeds:

user = User.create!(
  email: "email@email.com", 
  password: "Password123!", 
  extra_cash: Money.new(5000, "USD")
)

Using the annotate gem I can confirm the field is added to the database and my app is “aware” of it right?

# frozen_string_literal: true

class DeviseCreateUsers < ActiveRecord::Migration[7.1]
  def change
    create_table :users, id: :uuid do |t|
      t.monetize :extra_cash, amount: { precision: 20, scale: 4 }

So what’s going on? Do I need to somehow let Devise know of this field? How do I do that?

I figured it out, the extra_cash field is only available after I use the monetize callback.

class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable

  monetize :extra_cash_cents

  has_many :bank_accounts      
end

Now it works fine!