adding record in has man relation


I have many relation between notes and contact, a contact can has many notes and here is relation of contact


     * @return array relational rules.


    public function relations() {

        // NOTE: you may need to adjust the relation name and the related

        // class name for the relations automatically generated below.

        return array(

            'agent' => array(self::BELONGS_TO, 'Agents', 'agent_id'),

            'notes' => array(self::HAS_MANY, 'Note', 'contact_id'),




I want to add new note from a contact relation, when i have contact object it has many notes and i can see array here $contact->notes, now i want to add one more record into array, here is some which i want to acheive but don’t know exact way

$contact->notes[] = new Note();

$contact->notes[]->attributes = $_Post['Note'];


Please guide me how can i acheive this

$note = new Note();

$note->attributes = $_Post['Note'];

$note->contact_id =$contact->contact_id;