Skip to content

AveshCSingh/TartanHacks_Demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This code was used for a short Rails tutorial at TartanHacks. It was built on:
     Ruby: 1.9.2
     Rails: 3.1.3

 To run the code, clone the repository and run:

rake db:migrate
rails s

--

The following process was used to create this demo app. If you have any questions, email avesh@cmu.edu, or come find me at TartanHacks.

rails new debt_app

rails s; Go to localhost:3000

rails generate scaffold user name:string email:string

[Show migration in db/migrate]

rake db:migrate

[Show new code in controller and view]

rake routes
Go to localhost:3000/users/new

rails generate migration AddSSNToUsers SSN:string

[Show migration]

rake db:migrate

Create new user over terminal

Add SSN to app/views/_form.html.erb
Add SSN to app/views/show.html.erb

Show new user over web interface

#Create Debts
rails generate scaffold debt amount:integer user_id:integer
Add to models/debt.rb:
  belongs_to :user
  validates_presence_of :user
Add to models/user.rb:
  has_many :debts

Show on command line creating a new Debt in 2 ways:
     1. Debt.create...
     2. User.first.debts.create(:amount => 500)

Add ability to create debt from web interface:
    Add to app/views/debts/_form.html.erb
    Add to app/views/debts/show.html.erb


Demonstrate asset pipeline:
  Add Squirrel.jpg to app/assets/images
  Add to a view: <%= image_tag "Squirrel.jpg"%>

About

The [very basic] demo used in my TartanHacks presentation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published