#34 new
Michael MacDonald

Respecting primary key

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

Hi Ian,

I haven't verified this before thought I'd note it. When exploring the ticket #33 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.

Comments and changes to this ticket

  • Ian White

    Ian White October 11th, 2010 @ 04:28 PM

    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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Assign tickets to <b>Ian White</b>, so I get notified

People watching this ticket

Pages