# Update Context Update sets up an object using the build functionality, and then attempts to save it to the data source. Update does the following: - Find a model - Assigns attributes - Saves object ##### Example ```ruby class PeopleContext include SnFoil::CRUD::UpdateContext searcher PeopleSearcher policy PersonPolicy model Person end ``` ### Required Class Definitions - Searcher - Policy - Model ### Primary Action Saves the model ### Intervals (in order)
name | description | pre-defined functions |
---|---|---|
setup | Shared by all CRUD actions | |
setup_change | Shared by Create, Update, and Destroy actions | |
setup_update | Finds the model, Assigns attributes | |
before_change | Shared by Create, Update, and Destroy actions | |
before_update | ||
after_change_success | Shared by Create, Update, and Destroy actions | |
after_update_success | ||
after_change_failure | Shared by Create, Update, and Destroy actions | |
after_update_failure | ||
after_change | Shared by Create, Update, and Destroy actions | |
after_update |