intro to ruby on rails

Download Intro to Ruby on Rails

Post on 20-Jun-2015

298 views

Category:

Technology

2 download

Embed Size (px)

DESCRIPTION

Brief introduction to basics of Ruby on Rails.

TRANSCRIPT

  • 1. Ruby on RailsJune 17, 2011Elpizo Choi

2. What is Ruby on Rails?
MVC Framework for building web apps in Ruby
Uses Ruby classes to abstract out the various components of an app
Convention over configuration
3. Main Components
ActiveRecord(ORM think hibernate)
ActionController(business logic, routing)
ActionView(template parser)
Migrations, rake tasks
4. Creating a Rails app
5. Basic folder structure
apps folder
controllers, models, views where youll spend most your time
database.yml
Configures database
Gemfile
Configures external libraries used in app
6. a little configuration
7. a little configuration
8. Lets make a model
9. ActiveRecord::Base
When inherited, maps to table thats plural of class name
Team -> teams
Basic methods
Team.create()
Team.find()
Team.where().limit().sort().skip().first
Team.where().limit().sort().skip().all
10. first we need to create table
11. first we need to create table
12. first we need to create table
Rake

  • Ruby build tool

13. rake T to see all available tasks 14. rake db:migrate will run all database migrations that havent been run 15. Stores migrations that have already been run