What users want | CRUD | Action(URL) | Method/Verb | Data prep/manipulation | Redirect/Render | View |
---|---|---|---|---|---|---|
See all tasks | read | '/tasks' | GET | @tasks = task_manager.all | render | :index |
See one task | read | '/tasks/:id' | GET | @task = task_manager.find(id) | render | :show |
See form to put new task into | create | '/tasks/new' | GET | none | render | :new |
Submit form to create new task | create | '/tasks' | POST | task_manager.create(params[:task]) | redirect to '/tasks' | |
See a form to edit task info | upda |
What happens when you enter a url into the address bar of a web browser and hit enter
- This is a common interview question
Stores no state, simple text documents transferred back and forth.
- GET - Retrieve information identified by the Request-URI
- GET /users => All users
- POST - Create a new resource identified by the Request-URI
The server file serves as the main point of contact between the client and the server. The server file takes in the http request from the client and routes the client to the proper page base on the verb and the path of the http request.
Instance variables are useable in the view when it is rendered. local variables you pass in using a key value hash
erb(:index, locals => { :name_in_view => name_in_server }
Using ERB (Embedded RuBy) in the server call the erb method and tell it the view you want it to render.
NewerOlder