# Uninitialized constant error

**URL:** <https://www.ruby-forum.com/t/uninitialized-constant-error/95666>\
**Category:** Rails\
**Created:** [January 19, 2006, 8:52am UTC](https://www.ruby-forum.com/t/uninitialized-constant-error/95666 "2006-01-19T08:52:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thillerson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ebca7d/32.png) [@thillerson](https://www.ruby-forum.com/u/thillerson)\
**Post date:** [January 19, 2006, 8:52am UTC](https://www.ruby-forum.com/t/uninitialized-constant-error/95666/1 "2006-01-19T08:52:32Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thillerson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ebca7d/32.png) [@thillerson](https://www.ruby-forum.com/u/thillerson)\
**Post date:** [January 19, 2006, 10:51am UTC](https://www.ruby-forum.com/t/uninitialized-constant-error/95666/2 "2006-01-19T10:51:38Z")

</div>

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.
