mw007 mw007 Sun Mar 20 21:07:55 -0400 2011

Subject: Creating has_many relationships without lookup table and non-standard foreign key names

First, I'd like to reference this post: http://www.phpactiverecord.org/boards/4/topics/509-creating-has_many-relationship-with-non-standard-foreign_key-names.

My problem is a bit different, though. I have only two tables, listed here, http://pastie.org/1694317.

Basically, a Category can have many Pictures. Sort of like folders on a computer.

I'm trying to use the following AR models to create my relationship: http://pastie.org/1694331.

Obviously, my schema is a bit more complex than the single relationship I mentioned here. I'd like to get this one working first, then move on to some more complicated ones.

Any point in the right direction is appreciated.


mw007 mw007 Sun Mar 20 21:33:00 -0400 2011

Okay, I was able to come up with the following solution.
http://pastie.org/1694375

(1-1/1)