[Solar-talk] Using 'through' - a relationship headache

Raymond Kolbe rkolbe at gmail.com
Thu Nov 15 09:08:34 CST 2007


Using models, I am trying to setup a relationship between my tables, much
like the example posted on the wiki but I am not returning the data that IS
in the database.

Basically (this time around) I have 3 tables:

restaurants
->restaurant_id
->name
->market_id

connectiontracker
->restaurant_id
->pingcode_id
->created
->updated

pingcodes
->pingcode_id
->name
->created
->updated

So, the basic relationship is that the connectiontracker keeps track of a
connection, identifying the connection status by using ping codes. This is
pretty much the same relationship as the example in the wiki that uses a
posts_tags table, posts, and tags to keep track of what posts have what
tags.

Here are the classes:

http://pastebin.com/me8e49fb

This is what is returned using that setup:

http://pastebin.com/m1731839f

As you can see, it is returning connectiontracker just fine but it is not
returning pingcodes, or rather the appropriate ping code for the given
restaurant.

I have tried many different methods to accomplish this, many which make
people go 'eh?'. What am I missing with this setup? I made sure 1,000 times
that the data does exist in the tables.

Any help is much appreciated.

Thank you!
Raymond K.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20071115/a7979ce3/attachment.html


More information about the Solar-talk mailing list