# Stupid newbie question

**URL:** <https://www.ruby-forum.com/t/stupid-newbie-question/48662>\
**Category:** Rails\
**Created:** [November 23, 2005, 3:18am UTC](https://www.ruby-forum.com/t/stupid-newbie-question/48662 "2005-11-23T03:18:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonlee9](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4491bb/32.png) [@jasonlee9](https://www.ruby-forum.com/u/jasonlee9)\
**Post date:** [November 23, 2005, 3:18am UTC](https://www.ruby-forum.com/t/stupid-newbie-question/48662/1 "2005-11-23T03:18:30Z")

</div>

Sorry guys but I have to ask this as I’m completely stumped.

I have a table like so

party\_type  
±------+  
| id |  
| type |  
| \_name |  
±------+

And my relevant unit test portion (setup works fine):

def test\_truth  
assert\_equal 1, @part\_type.id # works fine  
assert\_equal “Person”, @party\_type.\_name # works as well  
assert\_equal “Person”, @party\_type.type # bombs  
end

## I get the following messages:

F  
Finished in 0.279416 seconds.

1. Failure:  
test\_truth(PartyTypeTest) [test/unit/party\_type\_test.rb:20]:  
\<“Person”\> expected but was  
.

1 tests, 2 assertions, 1 failures, 0 errors

* * *

For the life of me, I can’t get ‘type’ to be recognized. I’ve tried  
an alias, defining another method to return the ‘type’ attribute/col;  
all to no avail. Anyone have any suggestions for this? Tia.

thanks,

- jason

---

<div class="post-metadata">

**Author:** ![jasonlee9](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4491bb/32.png) [@jasonlee9](https://www.ruby-forum.com/u/jasonlee9)\
**Post date:** [November 23, 2005, 3:24am UTC](https://www.ruby-forum.com/t/stupid-newbie-question/48662/2 "2005-11-23T03:24:03Z")

</div>

Your fixture may be reading like this:

party\_type:  
id:1  
\_name:Person  
type:PartyType

What is your table party\_defn (details) and class ?

---

<div class="post-metadata">

**Author:** ![jasonlee9](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4491bb/32.png) [@jasonlee9](https://www.ruby-forum.com/u/jasonlee9)\
**Post date:** [November 23, 2005, 3:26am UTC](https://www.ruby-forum.com/t/stupid-newbie-question/48662/3 "2005-11-23T03:26:33Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On Nov 22, 2005, at 6:16 PM, Jason L. wrote:

> * * *
> 
> For the life of me, I can’t get ‘type’ to be recognized. I’ve tried  
> an alias, defining another method to return the ‘type’ attribute/  
> col; all to no avail. Anyone have any suggestions for this? Tia.

The type column is used for single-table inheritance.

Are you using it for this?

If not, I recommend you change the name of your column (perhaps  
“kind”) or set self.inheritance\_column = ‘ruby\_type’ in your Person  
class.

jeremy  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDg9LUAQHALep9HFYRAiNYAKDC+Jg1LBTrtSWfs1mayoeMoJSEQwCgrb1d  
2V54DSgT4SZX6Qj/sOmYTgM=  
=hCX/  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![jasonlee9](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/4491bb/32.png) [@jasonlee9](https://www.ruby-forum.com/u/jasonlee9)\
**Post date:** [November 23, 2005, 3:34am UTC](https://www.ruby-forum.com/t/stupid-newbie-question/48662/4 "2005-11-23T03:34:35Z")

</div>

Ah, self.inheritance\_column seemed to do the trick.

Thanks!
