Timothy N. Tsvetkov, Rails 3.1
Upcoming SlideShare
Loading in...5
×
 

Timothy N. Tsvetkov, Rails 3.1

on

  • 1,349 views

Timothy N. Tsvetkov & Gregory Mann's keynote on Rails 3.1 new features.

Timothy N. Tsvetkov & Gregory Mann's keynote on Rails 3.1 new features.

Statistics

Views

Total Views
1,349
Views on SlideShare
1,346
Embed Views
3

Actions

Likes
0
Downloads
10
Comments
0

3 Embeds 3

https://twitter.com 1
http://twitter.com 1
http://www.slashdocs.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Timothy N. Tsvetkov, Rails 3.1 Timothy N. Tsvetkov, Rails 3.1 Presentation Transcript

  • Ruby NoName Podcast Propaganda sponsorship
  • Rails 3.1
  • Rails 3.12 years of development 1234 commits 321 Contributors 243244 coffee caps 1 dhh View slide
  • Delivering Developers Happiness View slide
  • HTTP Streaming
  • HTTP StreamingMake your’s applications even faster
  • Browser startprocessing CSS and JSbefore you request DB
  • Yes, all DB requests actually in view
  • Yes, all DB requests actually in view But, who care?
  • Unicorn
  • listen 3000, :tcp_nopush => false
  • class PostsController
  • class PostsController stream
  • class PostsController stream :only => :index
  • class PostsController def index @posts = Post.cool_posts.all end
  • class PostsController def index @posts = Post.cool_posts.all render :stream => true end
  • <!DOCTYPE html><html><head> <title><%= yield :title %></title> ... ...</head><body><% content_for :title, "Projects" %>
  • <%= yield :title %><% content_for :title, "Projects" %>
  • <%= yield :title %> @posts = Post.cool_posts<% content_for :title, "Projects" %>
  • <%= yield :title %> @posts = Post.cool_posts<% provide :title, "Projects" %>
  • D’oh
  • Rack::Cache
  • Rack::Cache
  • Middlewares that needto manipulate the body
  • Middlewares that needto manipulate the body
  • 1.9.2 Only fibers
  • ActiveRecordIdentity Map by Emilio Tagua
  • user1 = User.find(1)user2 = User.find(1)user1 == user2 # => trueuser1.object_id == user2.object_id # => true
  • config.active_record.identity_map = true
  • Does not trackassociations :(
  • Post.has_many :comments, :dependent => :destroycomment = @post.comments.firstcomment.post = nilcomment.savePost.destroy(@post.id)
  • Post.has_many :comments, :dependent => :destroycomment = @post.comments.firstcomment.post = nilcomment.savePost.destroy(@post.id) comment will be destroyed
  • Prepared Statements
  • SELECT * FROM users WHERE id = 42;
  • SELECT * FROM users WHERE id = ?;
  • Works Prefect • SQLite • Postgres Complicated• MySQL
  • Role-basedmass-assignment protection
  • class Post < ActiveRecord::Base attr_accessible :title attr_accessible :title, :user_id, :as => :adminend
  • class Post < ActiveRecord::Base attr_accessible :title attr_accessible :title, :user_id, :as => :admin endPost.update_attributes(params[:post], :as => :admin)
  • Callable in Scope
  • class Filter < Struct.new(:klass) def call(*args); endendmodule CategoryFilter def call(category, *args) klass.where(:category => args.shift) super(*args) endendclass User < ActiveRecord::Base scope :combined, Filter.new(self).extend(NameFilter)end
  • jQuery by default
  • RJS has been extracted out to a gem
  • force_ssl
  • authenticity_token custom handling or to omit the token
  • Deprecated
  • AR options hash:conditions, :include, :joins,:limit, :offset, :order,:select, :readonly, :group,:having, :from, :lock
  • green_items = Item.scoped_by_colour(orange)
  • Questions?