Rails 3 And The Real Secret To High Productivity Presentation
-
Upload
railsconf -
Category
Technology
-
view
933 -
download
8
Transcript of Rails 3 And The Real Secret To High Productivity Presentation
![Page 1: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/1.jpg)
Rails 3 ..and the real secret to high productivity
![Page 2: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/2.jpg)
52004 - 2009
![Page 3: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/3.jpg)
"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." James McGovern
![Page 4: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/4.jpg)
![Page 5: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/5.jpg)
![Page 6: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/6.jpg)
![Page 7: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/7.jpg)
![Page 8: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/8.jpg)
We’re still here
![Page 9: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/9.jpg)
The philosophy of Rails 3
![Page 10: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/10.jpg)
![Page 11: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/11.jpg)
![Page 12: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/12.jpg)
![Page 13: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/13.jpg)
The progress of Rails 3
![Page 14: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/14.jpg)
New routerFaster
Route by subdomains, user agents, more
Route to other Rack machinery
![Page 15: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/15.jpg)
map.with_options(:controller => "sessions") do |sessions| sessions.login "login", :action => "new", :conditions => { :method => :get } sessions.connect "login", :action => "create", :conditions => { :method => :post } sessions.logout "logout", :action => "destroy", :conditions => { :method => :post }end
controller :sessions do match 'logout', :via => :delete, :to => :destroy, :as => :logout match 'login' do get :new, :as => :login post :create endend
![Page 16: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/16.jpg)
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 => :avatarend
resources :projects, :controller => :project do resources :attachments resources :participants do put :update_all, :on => :collection end resources :companies do resources :people resource :avatar endend
![Page 17: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/17.jpg)
XSS protection
![Page 18: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/18.jpg)
<%= comment.body %>
<%=h comment.body %>
<%# => "I've hacked you good! <script>" %>
<%# => "I've hacked you bad! <script>" %>
<%= comment.body %>
<%=raw comment.body %>
<%# => "I've hacked you good! <script>" %>
<%# => "I've hacked you bad! <script>" %>
![Page 19: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/19.jpg)
def safe_helper(text) content_tag(:div, text) + tag(:br)end
def needs_to_be_marked_safe_helper(text) (content_tag(:div, text) + "<br/>").html_safe!end
![Page 20: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/20.jpg)
JavaScript goes
unobtrusive & agnostic
![Page 21: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/21.jpg)
<%= link_to_remote "Delete", :url => @comment, :method => :delete %>
<a href="#" onclick="new Ajax.Request('/comments/1', {asynchronous:true, evalScripts:true, method:'delete'}); return false;">Destroy</a>
<%= link_to "Delete", @comment, :remote => true, :method => :delete %>
<a href="/comments/1" data-remote="true" data-method="delete">Destroy</a>
![Page 22: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/22.jpg)
<% remote_form_for(@comment) do %>
<form action="/comments" class="new_comment" id="new_comment" method="post" onsubmit="new Ajax.Request('/comments', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">
<% form_for(@comment, :remote => true) do %>
<form action="/comments" class="new_comment" id="new_comment" method="post" data-remote="true">
![Page 23: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/23.jpg)
<%= link_to "Delete", @comment, :method => :delete %>
<a href="/comments/1" onclick="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;">Destroy</a>
<a href="/comments/1" data-method="delete">Destroy</a>
![Page 24: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/24.jpg)
<%= link_to "Delete", @comment, :method => :delete, :confirm => "Are you sure?" %>
<a href="/comments/1" onclick="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;">Destroy</a>
<a href="/comments/1" data-method="delete" data-confirm="Are you sure?">Destroy</a>
![Page 25: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/25.jpg)
$(document.body).observe("click", function(event) { var element = event.findElement("a['data-remote']"); if (element) { var method = element.readAttribute("data-method") || "get"; new Ajax.Request(element.readAttribute("href"), { method: method }); event.stop(); }});
![Page 26: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/26.jpg)
More agnosticismAction ORM
Generators
![Page 27: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/27.jpg)
The great refactoringAbstract Controller + Action Dispatch
Action Relation underpins Active Record
Cherry picking from Active Support
Speedy callbacks
![Page 28: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/28.jpg)
The real secret to high productivity
![Page 29: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/29.jpg)
Renegotiate requirements
![Page 30: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/30.jpg)
![Page 31: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/31.jpg)
![Page 32: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/32.jpg)
![Page 33: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/33.jpg)
![Page 34: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/34.jpg)
![Page 35: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/35.jpg)
“Sure, whatever”
Stakeholders every where
![Page 36: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/36.jpg)
“I don’t know how”“It’s just too hard”“I’d be bored senseless”“That would kill the abstraction”
![Page 37: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/37.jpg)
![Page 38: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/38.jpg)
![Page 39: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/39.jpg)
Programmer
![Page 40: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/40.jpg)
Partner
![Page 41: Rails 3 And The Real Secret To High Productivity Presentation](https://reader033.fdocuments.in/reader033/viewer/2022060109/5556715dd8b42abc5a8b4d3a/html5/thumbnails/41.jpg)
Questions?