Shoulda Doesn’t like ‘Status’
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'
More from jbasdf
- A copy of ApplicationController has been removed from the module tree but is still active! And can’t dup NilClass
- Rails Conf Intro from Chad Fowler and Some Stuff from the Mountain West Ruby Conference
- Mac OSX and the Samsung ML1740 on a network
- Ruby on Rails i18n with the Rails I18n Textmate bundle
- How New Carpet and Rattlesnake turned me into a Consultant or What the Hell Happened?
Justin Ball is a software consultant and entrepreneur with a passion for Ruby. He evolved from a C++ and .Net monkey into a python programmer and finally found Ruby. In the rare moments when he isn't writing code, talking about code or measuring his code productivity in profanity per hour, you can find him on his bike in the mountains or on the roads surrounding Cache Valley. 









