declaring a scaffold variable in a controller
|
| View previous topic :: View next topic |
| Author |
Message |
AmeliaR
Joined: 31 May 2006 Posts: 142
|
Hi you know when you declare a scaffold variable in a controller and then cake puts up a scaffold... well how does cake know that you have done that ?
I mean is this some sort of heathen black magic? |
| |
|
|
|
|
Klimapol
Joined: 27 May 2006 Posts: 134
|
| Laughs |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| AmeliaR, you're extending AppController class. This class will watch if you declare that variable |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
Thanks Poolkop
"If you plan to relate tables, use foreign keys that look like: 'article_id'. The table name is singular, followed by an underscore, followed by 'id'."
So say i want to relate two tables
Users and posts
Can i just put a user_id key in the posts table or do i need a seperate table all together to handle the linking? |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| User_id at post |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| Sorry what ? |
| |
|
|
Poolkop
Joined: 01 Jun 2006 Posts: 123
|
| AmeliaR, put an user_id field in posts table |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
Cool thanks and what do you do for a many to many relationship ?
Is there any special naming convention for the linking table ? |
| |
|
|
jomanda
Joined: 19 May 2006 Posts: 70 Location: Germany
|
| yes posts_users in alphabetical order that is |
| |
|
|
|
|