By the end of this, students should be able to:
- Write SQL statements to select records
- Write Active Record queries to select and manipulate records
- Write controller actions using the ActiveRecord queries
- Fork/Clone this repo
- Change into this directory
- Run:
bundle && rake db:create db:migrate db:test:prepare
- Run:
rspec spec
to see tests failing - Write code in the rails controllers (nowhere else) to make the tests pass
- Once tests are passing, commit, push and make a pull request
In app/controllers/products_controller.rb
in the two empty strings, write the SQL queries needed to satisfy the tests. The goal is to select all records (index), and to select a single record (show) by ID.
In app/controllers/people_controller.rb
write the Active Record queries and Ruby code needed to make the tests pass. None of these are tricks and there are some lines of code that you shouldn't change (as commented). This is very standard looking Rails code.
Comment each action method in app/controllers/people_controller.rb
with the SQL that would be generated by the Active Record query.