So I updated my post model to what you see below and now when I go to
my index (index.ctp) view that I have listed on my first post nothing
shows up. Do I need to add anything in the controllers or the user
model?  Once get it to show properly how would I call the the User
displayname in my foreach loop in the index.ctp?

class Post extends AppModel {
    var $name = 'Post';
    var $belongsTo = array (
        'User' => array(
            'className' => 'User',
            'foreignKey' => 'user_id'
        )
    );
    var $validate = array (
        'title' => array(
            'rule' => 'notEmpty'
        ),
        'category' => array(
            'rule' => 'notEmpty'
        ),
        'body' => array(
            'rule' => 'notEmpty'
        ),
        'frontpage' => array(
            'rule' => 'numeric'
        )
    );
}
On Feb 23, 12:01 am, WebbedIT <p...@webbedit.co.uk> wrote:
> ^^ What @Andy says is right.
>
> Simple rule of thumb for hasMany/hasOne <-> belongsTo
> relationships ... whichever model your foreign_key is in, it belongs
> to the other model.
>
> Welcome to CakePHP, it should make learning complex PHP a lot easier
> for you.  I sometimes wish I hadn't taught myself a lot of bad habits
> by learning raw PHP first :)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to