Rails 2.0 Presentation

50 %
50 %
Information about Rails 2.0 Presentation

Published on December 13, 2007

Author: chacon

Source: slideshare.net


These are the slides from my presentation on Rails 2.0 at the Silicon Valley Ruby on Rails Meetup on Dec 13.

Rails 2.0 “evolution, not revolution”

Rails 2.0 Overview RESTful web architectures some small feature maturations removal of features determined to be not essential

Action Pack ActionController + ActionView

Multiview “Machine-Gunning .rhtml and .rxml” (action.mimetype.renderer) show.html.erb index.atom.builder edit.iphone.haml

Partial Layouts

Partial Layouts

Routing Resources

Routing Namespaces link_to ‘variants’, admin_product_variants_url(@product) /admin/products/:product_id/variants

Record Identification redirect_to(person) link_to(person.name, person) form_for(person)

HTTP Authentication


Exception Handling

controllers/application.rb rescue_from

Atom Feed Helper

Stolen from the DHH announcement

Mime::Type Predicates controller.request.format.html? controller.request.format.xml?

Performance Asset Servers Asset Caching Cookie Based Sessions

most browsers will only make up to two simultaneous connections to any one domain Asset Servers

config/environment.rb Asset Servers

config/environment.rb Asset Servers will always use the same server for a single file

Asset Caching

Cookie Based Sessions

example stolen from ryan daigle Cookie Sessions Security

Security CSRF Protection TextHelper#sanitize HTTP only cookies

CSRF Protection

Active Resource Short Overview of Resources

A consumer of RESTful resources Active Resource

A consumer of RESTful resources As ActiveRecord is a consumer of relational database resources Active Resource

ActiveResource Models

Active Resource Actions Http REST request Model request Request URI Response operation body find(id) GET n/a /people/id.xml <XML> Status: save (update) PUT <XML> /people/id.xml 200 OK Location: save (create) POST <XML> /people http://x/people/id.xml Status: destroy DELETE n/a /people/id.xml 200 OK list GET n/a /people <XML> credit: ryan diagle


Active Record


:allow_blank validates_numericality

:allow_blank validates_numericality

Sexy Migrations

“Cold Shower” Migrations

Err Sexy Migrations

Rails 2.0 Sexy 4 fewer lines + rails programmers == sexy


Query Cache

Query Cache Logging

Disabling the Query Cache

Fixtures Foxy Fixtures Collection Fixtures Fixture Performance

conferences.yml places.yml Foxy Fixtures

conferences.yml places.yml Foxy Fixtures

Was Now Collection Fixtures

Data Exchange to_xml, from_xml to_json, from_json

/conferences/show/1.js to_json


Other Stuff


rake notes

rake notes

rake notes

rake db rake db:create rake db:create:all rake db:drop rake db:drop:all rake db:reset rake db:rollback rake db:version

rake routes

rake routes route name, HTTP method, route path, route requirements

helper :all

rails my_new_app

Request Profiler RubyProf Wrapper ./script/performance/request -n 10 login_session.rb


initializers directory

initializers directory

initializers directory

config/preinitializer.rb loaded before the environment files

Scaffolding ./script/generate scaffold conference name:string description:text start_date:date end_date:date

Resourceful Scaffolding


gem install ruby-debug

add ‘debugger’ to code

./script/server -u



Upgrading to 2.0





Object Transactions


ActionWebService ActiveResource

syntax changes @params params[] @session session[] @flash flash[] @request request[] @env env[] find_all find(:all) find_first find(:first) render_partial render :partial :post => true :method => :post

start_form_tag end_form_tag form_for do end

start_form_tag end_form_tag form_tag </form>

Extracting to Plugins and Gems acts_as some js helpers commercial database adapters

./script/plugin install acts_as_list acts_as_nested_set acts_as_tree auto_complete in_place_editing

gem install activerecord-X-adapter --source http://gems.rubyonrails.com firebird frontbase informix openbase oracle sqlserver sybase

Upgrade Process gem install rails -y

Resources • Peepcode Rails2 PDF - Ryan Daigle ($9) • http://weblog.rubyonrails.org • /2007/12/7/rails-2-0-it-s-done • http://ryandaigle.com • /articles/2007/12/7/rails-2-0-final-released-summary-of-features • http://www.slashdotdash.net • /articles/2007/12/03/rails-2-upgrade-notes

Thanks! noesbueno.org/rails2

Work with me @ http://www.reactrix.com/careers.php schacon@gmail.com Sr. Web Developer Linux Systems Administrator Sr. Game/Interaction Programmer Computer Vision Engineer

Add a comment

Related pages

NetBeans Ruby Pack / Rails 2.0 PowerPoint PPT Presentation

NetBeans Ruby Pack / Rails 2.0. moriq@moriq.com 2008-03-15 第 24 回 Ruby/Rails 勉強会 @ 関西. Rails 2.0. evolution rather than revolution . by ...
Read more

Scott Chacon - Rails 2.0 Presentation

In about 30 minutes, I'll be at the Silicon Valley Ruby on Rails Meetup, where I'm scheduled to give a presentation on the newly released Rails 2.0.
Read more

Ruby 2.0 on Rails - Speaker Deck - Share Presentations ...

Slides for RubyConf 2012 talk "Ruby 2.0 on Rails" http://rubyconf.org/ Akira Matsuda. 33 Presentations. Star this Talk 90 Stars; Published in Programming;
Read more

GitHub - emachnic/rails_dev_windows: impress.js ...

rails_dev_windows - impress.js presentation for CodeMash
Read more

Ruby on Rails

Ruby on Rails is open source software, so not only is it free to use, you can also help make it better. More than 4,200 people already have contributed ...
Read more

Ruby on Rails - University of Alberta

Ruby on Rails Group Presentation Bram Wiebe Trevor Jones Wanying Luo Howard Chung CMPUT 410 Osmar Zaine November 16 2007 . Table of Contents Introduction 1
Read more

Ruby on Rails - Wikipedia, the free encyclopedia

Ruby on Rails; Original author(s) David Heinemeier Hansson: Developer(s) Rails Core Team: Initial release: 18 December 2005; 10 years ago (2005-12-18)
Read more

The Grails Framework

Grails is a powerful web framework, for the Java platform aimed at multiplying developers’ productivity thanks to a Convention-over-Configuration, ...
Read more