Coder Social home page Coder Social logo

tartanhacks_demo's Introduction

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 [email protected], 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"%>

tartanhacks_demo's People

Contributors

aveshcsingh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.