Generate the Article
model through the right rails generator. It should have at least the following columns:
title
, as astring
content
, as atext
Don't hesitate to crash test your new model in the rails console
:
new_article = Article.new(title: 'The meaning of life', content: "It's 42!")
new_article.valid? # => should be `true`
new_article.save # => should not display rollback warnings
Article.last # => should be the one you just saved
Add the faker
gem to your Gemfile
and
run bundle install
. Use this gem to generate 10 fake articles in
db/seeds.rb
. When your code is done, you can run:
rails db:seed
Generate your controller, and implement all 7 CRUD default actions to list, show, create, update and destroy an article.
You can now directly use the resources
shortcut in your routes.
Have a look at the live app to see what it should look like. Try to make the forms look like this with CSS. Create the icons using font awesome.