Rails 3 And The Real Secret To High Productivity Presentation
Upcoming SlideShare
Loading in...5
×
 

Rails 3 And The Real Secret To High Productivity Presentation

on

  • 2,650 views

DHH presentation from RailsConf09

DHH presentation from RailsConf09

Statistics

Views

Total Views
2,650
Views on SlideShare
2,643
Embed Views
7

Actions

Likes
4
Downloads
63
Comments
0

2 Embeds 7

http://www.slideshare.net 6
http://ub076:3000 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

Rails 3 And The Real Secret To High Productivity Presentation Rails 3 And The Real Secret To High Productivity Presentation Presentation Transcript

  • Rails 3 ..and the real secret to high productivity
  • 5 2004 - 2009
  • quot;You may have noticed that pretty much everyone in the Ruby camp are insultants with many of them being book authors attempting to capitalize on hype.quot; James McGovern
  • We’re still here
  • The philosophy of Rails 3
  • The progress of Rails 3
  • New router Faster Route by subdomains, user agents, more Route to other Rack machinery
  • map.with_options(:controller => quot;sessionsquot;) do |sessions| sessions.login quot;loginquot;, :action => quot;newquot;, :conditions => { :method => :get } sessions.connect quot;loginquot;, :action => quot;createquot;, :conditions => { :method => :post } sessions.logout quot;logoutquot;, :action => quot;destroyquot;, :conditions => { :method => :post } end controller :sessions do match 'logout', :via => :delete, :to => :destroy, :as => :logout match 'login' do get :new, :as => :login post :create end end
  • map.resources :projects, :controller => 'project' do |projects| projects.resources :attachments projects.resources :participants, :collection => { :update_all => :put } projects.resources :companies, :has_many => :people, :has_one => :avatar end resources :projects, :controller => :project do resources :attachments resources :participants do put :update_all, :on => :collection end resources :companies do resources :people resource :avatar end end
  • XSS protection
  • <%# => quot;I've hacked you good! <script>quot; %> <%= comment.body %> <%# => quot;I've hacked you bad! &lt;script&gt;quot; %> <%=h comment.body %> <%# => quot;I've hacked you good! &lt;script&gt;quot; %> <%= comment.body %> <%# => quot;I've hacked you bad! <script>quot; %> <%=raw comment.body %>
  • def safe_helper(text) content_tag(:div, text) + tag(:br) end def needs_to_be_marked_safe_helper(text) (content_tag(:div, text) + quot;<br/>quot;).html_safe! end
  • JavaScript goes unobtrusive & agnostic
  • <%= link_to_remote quot;Deletequot;, :url => @comment, :method => :delete %> <a href=quot;#quot; onclick=quot;new Ajax.Request('/comments/1', {asynchronous:true, evalScripts:true, method:'delete'}); return false;quot;>Destroy</a> <%= link_to quot;Deletequot;, @comment, :remote => true, :method => :delete %> <a href=quot;/comments/1quot; data-remote=quot;truequot; data-method=quot;deletequot;>Destroy</a>
  • <% remote_form_for(@comment) do %> <form action=quot;/commentsquot; class=quot;new_commentquot; id=quot;new_commentquot; method=quot;postquot; onsubmit=quot;new Ajax.Request('/comments', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;quot;> <% form_for(@comment, :remote => true) do %> <form action=quot;/commentsquot; class=quot;new_commentquot; id=quot;new_commentquot; method=quot;postquot; data-remote=quot;truequot;>
  • <%= link_to quot;Deletequot;, @comment, :method => :delete %> <a href=quot;/comments/1quot; onclick=quot;var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit();return false;quot;>Destroy</a> <a href=quot;/comments/1quot; data-method=quot;deletequot;>Destroy</a>
  • <%= link_to quot;Deletequot;, @comment, :method => :delete, :confirm => quot;Are you sure?quot; %> <a href=quot;/comments/1quot; onclick=quot;if (confirm('Are you sure?')) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = this.href;var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'delete'); f.appendChild(m);f.submit(); };return false;quot;>Destroy</a> <a href=quot;/comments/1quot; data-method=quot;deletequot; data- confirm=quot;Are you sure?quot;>Destroy</a>
  • $(document.body).observe(quot;clickquot;, function(event) { var element = event.findElement(quot;a['data-remote']quot;); if (element) { var method = element.readAttribute(quot;data-methodquot;) || quot;getquot;; new Ajax.Request(element.readAttribute(quot;hrefquot;), { method: method }); event.stop(); } });
  • More agnosticism Action ORM Generators
  • The great refactoring Abstract Controller + Action Dispatch Action Relation underpins Active Record Cherry picking from Active Support Speedy callbacks
  • The real secret to high productivity
  • Renegotiate requirements
  • “Sure, whatever” Stakeholders every where
  • “I don’t know how” “It’s just too hard” “I’d be bored senseless” “That would kill the abstraction”
  • Programmer
  • Partner
  • Questions?