STI and model loading question

when trying to figure out STI i’ve hit a problem…

in my address.rb file i have the following:

class Address < ActiveRecord::Base

validates_presence_of :name, :address_1, :city, :state, :zip

belongs_to :order
end

class BillingAddress < Address
end

class ShippingAddress < Address
end

now when in the console and i try to access BillingAddress, i get
“uninitialized constant” errors, but if i access Address first,
BillingAddress loads up fine. i thought all of the models were loaded
when the app was started, so why is it not recognizing my sub classes?
my other question is what i need to put in my code to make sure that i
can access the subclass even if i haven’t accessed the parent one
first? i’m guess i need to load it somewhere but i don’t know where or
what syntax to use.

This one has bitten me before too.

There are a couple of ways around it, but the one that I use is this:

Create separate billing_address.rb and shipping_address.rb files in
your models directory instead of including them in your address.rb
file.