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

Like this? Share it with your network

Share

Timothy N. Tsvetkov, Rails 3.1

  • 1,391 views
Uploaded on

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.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,391
On Slideshare
1,388
From Embeds
3
Number of Embeds
3

Actions

Shares
Downloads
10
Comments
0
Likes
0

Embeds 3

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

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Ruby NoName Podcast Propaganda sponsorship
  • 2. Rails 3.1
  • 3. Rails 3.12 years of development 1234 commits 321 Contributors 243244 coffee caps 1 dhh
  • 4. Delivering Developers Happiness
  • 5. HTTP Streaming
  • 6. HTTP StreamingMake your’s applications even faster
  • 7. Browser startprocessing CSS and JSbefore you request DB
  • 8. Yes, all DB requests actually in view
  • 9. Yes, all DB requests actually in view But, who care?
  • 10. Unicorn
  • 11. listen 3000, :tcp_nopush => false
  • 12. class PostsController
  • 13. class PostsController stream
  • 14. class PostsController stream :only => :index
  • 15. class PostsController def index @posts = Post.cool_posts.all end
  • 16. class PostsController def index @posts = Post.cool_posts.all render :stream => true end
  • 17. <!DOCTYPE html><html><head> <title><%= yield :title %></title> ... ...</head><body><% content_for :title, "Projects" %>
  • 18. <%= yield :title %><% content_for :title, "Projects" %>
  • 19. <%= yield :title %> @posts = Post.cool_posts<% content_for :title, "Projects" %>
  • 20. <%= yield :title %> @posts = Post.cool_posts<% provide :title, "Projects" %>
  • 21. D’oh
  • 22. Rack::Cache
  • 23. Rack::Cache
  • 24. Middlewares that needto manipulate the body
  • 25. Middlewares that needto manipulate the body
  • 26. 1.9.2 Only fibers
  • 27. ActiveRecordIdentity Map by Emilio Tagua
  • 28. user1 = User.find(1)user2 = User.find(1)user1 == user2 # => trueuser1.object_id == user2.object_id # => true
  • 29. config.active_record.identity_map = true
  • 30. Does not trackassociations :(
  • 31. Post.has_many :comments, :dependent => :destroycomment = @post.comments.firstcomment.post = nilcomment.savePost.destroy(@post.id)
  • 32. Post.has_many :comments, :dependent => :destroycomment = @post.comments.firstcomment.post = nilcomment.savePost.destroy(@post.id) comment will be destroyed
  • 33. Prepared Statements
  • 34. SELECT * FROM users WHERE id = 42;
  • 35. SELECT * FROM users WHERE id = ?;
  • 36. Works Prefect • SQLite • Postgres Complicated• MySQL
  • 37. Role-basedmass-assignment protection
  • 38. class Post < ActiveRecord::Base attr_accessible :title attr_accessible :title, :user_id, :as => :adminend
  • 39. class Post < ActiveRecord::Base attr_accessible :title attr_accessible :title, :user_id, :as => :admin endPost.update_attributes(params[:post], :as => :admin)
  • 40. Callable in Scope
  • 41. 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
  • 42. jQuery by default
  • 43. RJS has been extracted out to a gem
  • 44. force_ssl
  • 45. authenticity_token custom handling or to omit the token
  • 46. Deprecated
  • 47. AR options hash:conditions, :include, :joins,:limit, :offset, :order,:select, :readonly, :group,:having, :from, :lock
  • 48. green_items = Item.scoped_by_colour(orange)
  • 49. Questions?