Stupid newbie question

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

Your fixture may be reading like this:

party_type:
id:1
_name:Person
type:PartyType

What is your table party_defn (details) and class ?

-----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-----

Ah, self.inheritance_column seemed to do the trick.

Thanks!