Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Respecting primary key

#34

Hi Ian,

I haven't verified this before thought I'd note it. When exploring the ticket #33 Error with Ruby 1.9.2 - Can't add a new key into hash during iteration I discovered that it seems that Pickle doesn't respect the primary key attribute of an association.

For example, in my app we have two models: Placement and Registration. A placement belongs to a registration however, circumstances dictate that the id of the Registration model is not actually the real registration id, so we have a registration_id in both the Placement and Registration models and make the association against these eg:

belongs_to :registration, :primary_key => "registration_id"

So, placement.registration_id = registration.registration_id

But this means, in my feature I can't use:

Then a placement should exist with registration: the registration

It does work with the setup step though eg:

Given a placement exists with registration: the registration

Anyway, I haven't looked into it much at this stage. Again, I'm not sure what changes will result from your refactoring.

Cheers,

Michael.

Reported by Michael MacDonald · October 11th, 2010 @ 01:34 AM

State: new
Milestone: none
Assigned to: Ian White Ian White

Activity

  1. Ian White
    Ian White

    Hey Michael,

    I've been working on exactly this stuff, in the new pickle. The new pickle uses to_key, and proper assoc introspection to sort this stuff out.

    Cheers,
    Ian

    October 11th, 2010 @ 04:28 PM

  2. Michael MacDonald

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.