Skip to content

Instantly share code, notes, and snippets.

@triskweline
Last active January 3, 2016 23:49
Show Gist options
  • Save triskweline/8537267 to your computer and use it in GitHub Desktop.
Save triskweline/8537267 to your computer and use it in GitHub Desktop.

You Look Nice Today

A sample application for our Rails workshop

This is the demo application for our Rails Workshop, a yearly event held by makandra to tell students about the Ruby on Rails framework and test-driven development.

The application was inspired by the wonderful emergency compliment service. You should make that website your homepage and buy all their prints.

How to explore this repository

This repository contains the same application multiple times, in different stages of development. As we move along the stages, we add more and more functionality.

This stage shows a very simple Rails application with a single route, a single controller and no model.

Noteworthy files:

routes.rb : Our routes setup file. This maps incoming browser requests to controller actions. compliments_controller.rb : Our one and only controller. It fetches a compliment and puts it into an instance variable @compliment.

stage-02: Model / View / Controller interaction : Moves controller code into a Ruby model Compliment

stage-03: Database access with ActiveRecord : Moves compliments into the database.

stage-04: ActiveRecord validations and form helpers : You can now submit your own compliments.

stage-05: ActiveRecord associations : Introduces ratings for compliments.

stage-06: Test-driven development : Introduces Cucumber tests and RSpec tests for the functionality above.

How to run the example applications

  1. Install Ruby. See the official installation instructions. If you're on Linux or OS X we recommend RVM. If you're on Windows we recommend Ruby Installer.

  2. Copy this repository to your hard drive. You can use Git or simply download as ZIP.

  3. You can now cd into each stage folder, install dependencies and start a Rails server:

     cd stage-01
     bundle
     rails server
    
  4. You can now access the application under http://localhost:3000.

  5. Once you're done (or want to switch to a different stage), press CTRL+C inside your server terminal to stop your server.

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