Created
May 30, 2017 21:57
-
-
Save aspencer8111/c5ad06da7975cb40e6f7f84754ca001a to your computer and use it in GitHub Desktop.
Routes n stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources :widgets | |
# Create | |
GET /widgets/new -> New action controller -> @widget = Widget.new -> view | |
POST /widgets -> Create action controller -> @widget.save(params) -> reidrect | |
# Read | |
GET /widgets -> Index action controller -> @widgets = Widget.all | |
GET /widgets/:id -> Show action controller -> @widget = Widget.find(params(:id)) | |
# Update | |
GET /widgets/:id/edit -> Edit action controller -> @widget = Widget.find(:id) -> view | |
PUT /widgets/:id -> Update action controller -> @widget.save(new params) -> reidrect | |
# Delete | |
Destroy /widgets/:id -> Destroy action controller -> @widget.find(params[:id]).destroy -> redirect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment