Skip to content

Commit ecf12b3

Browse files
committed
added new documentation
1 parent 3404dac commit ecf12b3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,22 @@ class Todo_model extends MY_Model {
189189
),
190190
);
191191
}
192+
193+
// Models will not be saved if they don't pass validation.
194+
$todo = $this->todo_model->new_model();
195+
$todo->save(); // FALSE
196+
$todo->title = 'Wash the dishes.';
197+
$todo->save(); // TRUE
198+
199+
// To bypass validation, pass options with validate set to FALSE.
200+
$todo = $this->todo_model->new_model();
201+
$todo->save(array('validate' => FALSE)); // TRUE
192202
```
193203

194204
Anything valid in the form validation library can be used here. To find out more about the rules array, please [view the library's documentation](http://codeigniter.com/user_guide/libraries/form_validation.html#validationrulesasarray).
195205

196206
With this array set, each call to `save()` or `update_attributes()` will validate the data before allowing the query to be run.
197207

198-
**Unlike the CodeIgniter validation library, this won't validate the POST data, rather, it validates the data passed directly through.**
199-
200208
Callbacks
201209
---------
202210

0 commit comments

Comments
 (0)