Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Table of Contents

Getting Started


  • Install RVM
  • Install Ruby
  • Install Rails

Generate the Blog Application

  • rails new blog
  • Browse the generated code
  • Play around in the console

Start the Server

Active Record



  • one-to-one
  • one-to-many
  • many-to-many
  • belongs to


  • rake db:migrate


Query Interface

  • Conditions
  • Ordering
  • Pagination
  • Group

Action View

  • ERB (HTML with embedded Ruby)
  • Haml / Slim
  • render
  • Layout
  • Partial

Action Controller

  • Action
  • Parameters
  • Session
  • Flash message
  • Cookie
  • Error handling
  • Routing

Many comments to one post

  • Generate a comment model
  • Run the migration
  • Create one_to_many association
  • Create comments controller
  • CRUD actions and views for comments
  • Configure the routes

Deploy on Heroku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment