Skip to content

Instantly share code, notes, and snippets.

@trantorLiu
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trantorLiu/71e301470d8452a7659c to your computer and use it in GitHub Desktop.
Save trantorLiu/71e301470d8452a7659c to your computer and use it in GitHub Desktop.
Table of Contents

Getting Started

Installation

  • 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

CRUD

Association

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

Migration

  • rake db:migrate

Validation

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