CSC/ECE 517 Spring 2013/ch1a 1b mh: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 26: Line 26:
====Comparison of Update and Create Actions====
====Comparison of Update and Create Actions====


==Destroy==
===Destroy===


<pre>
<pre>

Revision as of 00:13, 8 February 2013

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)


Pitfalls in MVC Design

Migration to Service Oriented Architecture

Summary