- Create a new rails app using the rails app generator
- Scaffold the resources shown below using rails generators
Note: Don't forget to initialize and setup the database as part of your scaffolding process.
User
attribute | type |
---|---|
id | integer |
string | |
active | boolean |
created_at | datetime |
updated_at | datetime |
Task
attribute | type |
---|---|
id | integer |
name | string |
priority | integer |
completed_at | datetime |
created_at | datetime |
updated_at | datetime |
Write all of your answers to the questions below in a separate readme named SOLUTIONS.md.
First, start the rails server. Then, make a request to /tasks/new
, fill out the form and submit it in order to create a new task.
- What controller and action handles the data from the form submission?
- What controller and action would be used if you did a
GET
request on the/users
route? - Write out the step-by-step process that your rails application will take to render the
tasks/new
route. - What file is responsible for managing the mapping between your application and the
tasks
database table?
-
Explain all 7 of the RESTful actions in Rails
- List each action by its name
- Explain which HTTP verbs pair with each action
- Write a short sentence for each action that summarizes what it does
Our application has all 7 actions available for both Users and Tasks. We don't want that--we want to set limits on these resources.
- Limit users resource to only allow
index
andshow
- Limit tasks resource to allow everything except
destroy
- remove the corresponding controller actions that are no longer routable
We removed the routes to create a User because we only want developers to be able to do that. The way our developers will create new users for this app is to use the rails console. Use the rails console to create 2 users. Paste the commands you used into the SOLUTIONS.md
file.