Rails Decal

Lecture 6 - Edit, Update, Delete

Logistics

CRUD

  • Create
  • Read
  • Update
  • Destroy

Edit

Update

  • Endpoint to update a resource

Delete

  • Endpoint to delete a resource
  • Page where you put in the information to update a resource

Strong Parameters

  • Still required for updating
  • Same reasoning as create

Paths

Resources are a convenient way to set up a lot of default path's:

http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions

 

has_one

Model A has one Model B

 

Model B has a column model_a_id

belongs_to

Model A belongs to Model B

 

Model A has a column model_b_id

has_many

Model A has many Model B

 

Model B has a column model_a_id

Live Coding

Spring 2015 - Week 6: Index, Show, New, Create

By Rails Decal

Spring 2015 - Week 6: Index, Show, New, Create

  • 1,065