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.