Fork and clone this repository and follow the instructions below. Make at least one commit for each section. When finished, push your commits to your forked repository and submit a Pull Request back to the original repository.
Note: This repo already contains an empty rails app.
- In the terminal run the command to create your database.
- Create two models for
Post
andComment
where comments are owned by posts. - Database table for
Post
should have two attributes:content
(string) andis_published
(boolean) and table forComment
should have an attributebody
(string). - From the command line, run the appropriate
rails
command to generate your schema. - Create two
Post
instances in your seed file, then run your seed file from the command line.
Remember to start your Rails server to inspect your application in the browser.
- Set up routes and controller actions for the
index
,show
,new
, andcreate
for thePost
model only. (Note: only use instance variables@posts
and@post
for sending data to the view) - Create views for the
index
,show
andnew
actions. (Note:index
andshow
views MUST render the post('s)content
property, and thenew
view must have a namespaced form field forcontent
)
Before you begin, run the test suite (instructions below) to see all the checks that will be run against your work.
Pay close attention to lines showing Error - uninitialized constant NAME
. This tells you a file hasn't been created or the contents haven't been defined properly. There are tests waiting to run which can't proceed until you set up those files.
Your job is to get the results showing 0 failures
, and have no lines showing Error - uninitialized constant
Once you think you've satisfied one of the above steps, run the test suite to double-check your work.
To run the tests, first ensure all gems from the Gemfile are installed:
bundle install
Then call the test runner each time you want to check your code.
For Section I only
rspec --format documentation spec/models_migrations_spec.rb
For Section II only
rspec --format documentation spec/routes_controllers_views_spec.rb
Display test results for both sections at Once
rspec --format documentation