CSC/ECE 517 Spring 2013/ch1a 1b mh
Ruby CRUD - Update and Destroy
Introduction
CRUD
Edit/Update
locate the object @object = Object.find params(:id) update it @object.update_attributes!(params[:param]) inform of successful update flash[:notice] go to the updated object redirect_to object_path(@object)
Comparison of Update and Create Actions
Destroy
locate the object @object = Object.find params(:id) destroy it @object.destroy inform of successful update flash[:notice] = "Object '#{@object.title}' deleted." go to the updated object redirect_to object_path(@object)