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:in `setup''
# 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 Berger <djberg96-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > 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:in `setup'' > > # 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'') >Try: @record = site_location(:zzustest-sch01) symbol, not string HTH, Jeffrey
Marnen Laibow-Koser
2009-Oct-02 01:44 UTC
Re: Problem with composite primary keys, fixtures
Daniel Berger 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. [...]> > DanBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
On Oct 1, 4:48 pm, "Jeffrey L. Taylor" <r...-f/t7CGFWhwGcvWdFBKKxig@public.gmane.org> wrote:> Quoting Daniel Berger <djber...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > > > 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:in `setup'' > > > # 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'') > > Try: @record = site_location(:zzustest-sch01) > > symbol, not stringI don''t think it matters, but I tried it just in case. Same error. Regards Dan