On Tue, Mar 10, 2009 at 3:55 AM, boscovgrunenfeld <[email protected]> wrote:
> When I bake the views, I get a nice drop-down box for the Members view > to select the chapter (Members belongsTo Chapters via the foreign key > chapter_id), but I'm getting regular text boxes for the treasurer and > contact of the chapter, probably because of the naming convention (I > obviously can't call those fields member_id). > > Nevermind, I solved that problem! I looked at how the chapter was working for members, and copied that association, so now Member has a hasMany relationship with Contact and Treasurer, foreign keys contact_id and treasurer_id of the Chapter class. And Chapter has a belongsTo association with Contact and Treasurer, with the same foreign keys and the Member class. I now have drop-downs for Contact and Treasurer. My relationships don't *sound* right to me, but they're working at the moment. :P Now the weird problem I'm having is that I noticed I didn't have a drop-down for state in either chapter or member (I have a states table that lists all the US states and abbreviations). So I copied the relationships that were getting me drop-downs, and the chapter views now have a state drop-down, but the member views don't?!? I have the exact same code in both models... Both Member and Chapter have belongsTo relationships with State on foreign key state_id (and both chapters and members tables list state_id as their foreign keys referencing states(id) in the MySQL database), and the State model has hasMany relationships with both Chapter and Member on foreign key state_id. I rebaked everything, and the code is copied and pasted between the Member and Chapter models, so I don't know what would cause it to show the drop-down for one and not the other? -Vera --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
