Uninitialized constant error

I have a single table inheritance model for some classes
Payment < ActiveRecord::Base
CreditCardPayment < Payment
ECheckPayment < Payment
ManualPayment < Payment

they all get persisted to the payments table

I’m getting an error: ‘uninitialized constant Payment’ when trying to
create a new instance of any of these classes. At one point in my
process I store the payment in a session variable, but I’ve it seems
random as to when this happens: before or after that gets set. I even
tried explicitly requiring the payment class in the sub classes, and
still get the error.

I’m using Webrick on ruby 1.8.3 installed on cygwin on a Windows XP
machine.

Any ideas what’s going on? As I’m sure we all are, I’m under a time
crunch, and this is an unexpected error. Please help!

Tony Hillerson wrote:

I have a single table inheritance model for some classes
Payment < ActiveRecord::Base
CreditCardPayment < Payment
ECheckPayment < Payment
ManualPayment < Payment

they all get persisted to the payments table
Do you have a ‘type’ column in the payments table? I presume you do,
but it’s always best to check…

I’m using Webrick on ruby 1.8.3 installed on cygwin on a Windows XP
machine.
That could be a source of problems: the Rails site specifically
recommends against 1.8.3.

I’d ditch cygwin ruby and use the one-click installer if I were you,
just to get rid of the question mark. It’s working fine for me.