Shoulda Doesn’t like ‘Status’

July 25th, 2008 by Justin Ball

One of the models in a project I am working on right now ends in 'status'. Rails handles that just find but in my tests I started noticing an odd error:


test: Lookup should belong_to lookup_status. (LookupTest):
NameError: uninitialized constant LookupStatu

The Shoulda test looks like this:

should_belong_to :lookup_status

Nothing to complicated there. Should recognizes the relationship just find but when it tries to find a class it goes looking for LookupStatu. I fixed this by adding the the class name to the relationship thus:


belongs_to :lookup_status, :class_name => 'LookupStatus'

Tags:   · · No Comments

Leave A Comment

0 responses so far ↓

  • There are no comments yet.