function edit($id)
{
//Note: The property model is automatically loaded for us at $this->Property.
// Check to see if we have form data...
if (empty($this->data))
{
$this->Property->id = $id;
$this->data = $this->Property->read();//populate the form fields with the current row
}
else
{
// Here's where we try to save our data. Automagic validation checking
if ($this->Property->save($this->data['Property']))
{
//Flash a message and redirect.
$this->flash('Your information has been saved.',
'/properties/view/'.$this->data['Property']['id'], 2);
}
//if some fields are invalid or save fails the form will render
}
}