Ruby on Rails
Download
Report
Transcript Ruby on Rails
RUBY ON RAILS
It’s so rad
What we’ll cover
What is Ruby?
What is RoR?
Why RoR?
Developing with RoR
Deployment
Demo
Questions
What is Ruby?
Object-oriented language
Written in 1995 by some smart Japanese man
Influenced by PERL, Python, and Lisp (but mostly
Python)
EASY to understand, simple syntax
What is RoR?
Full stack web application framework
Written in Ruby (duh)
Since 2004
Open Source
Focused on rapid application development
Why Ruby on Rails?
Rails is a framework
Python – TurboGears, Django
Java - JSP/Servlets, Struts
PHP – Cake, Symfony
Convention over Configuration
Super fast to get started writing useable code
class Project < ActiveRecord::Base
belongs_to :portfolio
has_one :project_manager
has_many :milestones
end
Developing with RoR
Rails gives the developer a solid infrastructure to build a
web application
Model View Controller (MVC)
Model, the Object Relational Mapper
Automatically maps the database to objects
Very easy and natural to work with
Thin layer with SQL – dynamically generates SQL queries
User.find_all
User.find(:first, :conditions => [“user = ? AND password =?”], user,
pass)
Controller, the logic of the application
View, provides HTML templates and UI helpers
Developing with RoR
Developing with RoR
Support many database back-ends (db agnostic)
Oracle,
MySQL, PosgreSQL, SQLite
Built-in support for AJAX
Built-in functional and unit testing
Code tests while you develop
Test templates are automatically generated
Rails comes with a complete toolbox of classes,
helpers and utilities
Deployment
Rails apps are compatible with Unix and Windows
environments
Rails apps can be deployed on multiple web server
Configurations
Easy control of the deployment with Capistrano
Mod_rails (Phusion Passenger)
Mongrel/Mongrel Cluster (plus some Apache goodness for proxy)
FastCGI – running behind Apache or Lighty
CGI
WEBrick – a standalone Ruby web server, easy for development
A scripting tool to control the deployment of the application on multiple sites
Easy control of schema migration
rake migrate VERSION=3
Demo
Real-time demo of the “Blog in 15 Minutes” (so it
will probably take at least 20)