In this application, users will need to Create, Read, Update, and Delete the following resources:
- name (string)
- bio (text)
- dob (string)
- image_url (string)
- name (string)
- bio (text)
- dob (string)
- image_url (string)
- title (string)
- year (integer)
- duration (integer)
- description (text)
- image_url (string)
You will ultimately build something similar to Photogram Golden Seven, but with different tables/columns.
Use the detailed instructions in the README of the photogram_golden_seven repository as a guide.
-
Ensure that you've forked this repo to your own GitHub organization.
-
Set up a Cloud9 workspace as usual based on your repo.
-
bin/setup -
Run Project
-
Navigate to the live app in Chrome.
-
Create all three models and databases table using
rails generate model ...at a Terminal prompt as per the Crud with Ruby Cheatsheet.To prevent typos, you can copy-paste the following commands:
rails g model director name:string bio:text dob:string image_url:stringrails g model actor name:string bio:text dob:string image_url:stringrails g model movie title:string year:integer duration:integer description:text image_url:string -
To actually execute the instructions that you just generated to create the database tables, at a Terminal prompt do
rails db:migrate -
Add a few rows to each table through Rails Console or ActiveAdmin (navigate to
/adminin the live app and sign in with[email protected] / password).Or, alternatively, you can run
rails dev:primefrom the command line, which will pre-populate ten rows in each table (I wrote a script to save you some typing). (You need to first create all three tables with exactly the column names above in order for this to work.) -
Build the Golden Seven to allow users to interact with all three tables through their web browsers. Refer to the README of
photogram_golden_seven.
- Build a way to see a list of all rows in the table, e.g., by visiting http://localhost:3000/directors
- Build a way to see the details of an individual row, e.g., by visiting http://localhost:3000/directors/4
- Build a way to delete an individual row, e.g., by visiting http://localhost:3000/delete_director/4
- Add links to the index page and show pages to make it easier to visit these URLs.
- Build a way to see a blank form to add a new row, e.g., by visiting http://localhost:3000/directors/new_form
- Build the complementary action to receive inputs from that form and actually save them into a new row.
- Build a way to see a pre-populated form to edit an existing row, e.g., by visiting http://localhost:3000/directors/4/edit_form
- Build the complementary action to receive inputs from that form and actually update the existing row with them.
- Note: If you run into an error that talks about "URI too long", that's because the bio is too long to fit in the query string. This is not an error for you to worry about; we'll talk about how to fix it next time. For now, just shorten the bio and re-submit the form.
Rinse and repeat for the other two tables, actors and movies. Good luck, ask lots of questions!