josegonzalez/sanction — pull request #23 by LimeBlast (2012-11-21 14:14:41+00:00)
Title: Added permit() method

Because I prefer using `read()` (rather than `find('first')`) to get records from the database for editing purposes, and because you're unable to pass any extra parameters to the `read()` method, I've created a simple `permit()` method to let you activate the permit behaviour dynamically.

Where as before, I would have to use the following find code to pull the data ready for editing (which, while simple enough, is a little messy):

$params = array(
'conditions' => array('id' => $id),
'permit_skip' => false,
);
$this->request->data = $this->Story->find('first', $params);

I'm now able to do this instead:

$this->Story->permit(array('skip' => false));
$this->request->data = $this->Story->read(null, $id);

For this to work, however, I've had to remove all references to `$this->modelDefaults` as this was overwriting the settings I passed in via `permit()`. There may be some higher purpose to `$this->modelDefaults` that I don't understand, in which case I'll have to figure out another way of doing this.

But if not, I hope this will make a good addition to the plugin.

:{) <--- movember