Problem with composite primary keys, fixtures

Hi,

Rails 2.3.4
Composite Primary Keys 2.3.2

I’m having trouble loading fixture data for models with composite
primary keys.

NoMethodError: You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.first
vendor/gems/composite_primary_keys-2.3.2/lib/
composite_primary_keys/base.rb:261:in find_from_ids' test/unit/site_location_test.rb:10:insetup’

site_location.yml

zzustest-sch01:
schoolid: ZZUSTEST
siteid: SCH-01
latitude: 29.4266
longitude: -98.54788
elevation: 224.3
datasource: 1
uttimestamp: <%= Date.new(2009, 6, 18) %>
enteredelevation: 198

line 10 of the setup method

@record = site_location(‘zzustest-sch01’)

Has anyone else seen this?

Regards,

Dan

Quoting Daniel B. [email protected]:

You might have expected an instance of Array.
latitude: 29.4266
longitude: -98.54788
elevation: 224.3
datasource: 1
uttimestamp: <%= Date.new(2009, 6, 18) %>
enteredelevation: 198

line 10 of the setup method

@record = site_location(‘zzustest-sch01’)

Try: @record = site_location(:zzustest-sch01)

symbol, not string

HTH,
Jeffrey

Daniel B. wrote:

Hi,

Rails 2.3.4
Composite Primary Keys 2.3.2

I’m having trouble loading fixture data for models with composite
primary keys.

That’s partly because fixtures are poorly implemented and create more
problems than they solve. Consider Machinist instead.

[…]

Dan

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Oct 1, 4:48 pm, “Jeffrey L. Taylor” [email protected] wrote:

site_location.yml

line 10 of the setup method

@record = site_location(‘zzustest-sch01’)

Try: @record = site_location(:zzustest-sch01)

symbol, not string

I don’t think it matters, but I tried it just in case. Same error.

Regards

Dan