Your SlideShare is downloading. ×
0
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 a...
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 => quo...
map.resources :projects, :controller => 'project' do |projects|
  projects.resources :attachments
  projects.resources :pa...
XSS protection
<%# => quot;I've hacked you good! <script>quot; %>
<%= comment.body %>

<%# => quot;I've hacked you bad! &lt;script&gt;quo...
def safe_helper(text)
  content_tag(:div, text) + tag(:br)
end

def needs_to_be_marked_safe_helper(text)
  (content_tag(:d...
JavaScript goes
unobtrusive & agnostic
<%= link_to_remote quot;Deletequot;, :url => @comment, :method => :delete %>

<a href=quot;#quot; onclick=quot;new Ajax.Re...
<% remote_form_for(@comment) do %>

<form action=quot;/commentsquot; class=quot;new_commentquot; id=quot;new_commentquot;
...
<%= link_to quot;Deletequot;, @comment, :method => :delete %>

<a href=quot;/comments/1quot; onclick=quot;var f =
document...
<%= link_to quot;Deletequot;, @comment, :method => :delete, :confirm
=> quot;Are you sure?quot; %>

<a href=quot;/comments...
$(document.body).observe(quot;clickquot;, function(event) {
  var element = event.findElement(quot;a['data-remote']quot;);...
More agnosticism
     Action ORM
      Generators
The great refactoring
    Abstract Controller + Action Dispatch
   Action Relation underpins Active Record
     Cherry pic...
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?
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
Rails 3 And The Real Secret To High Productivity Presentation
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

937

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
937
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

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

  1. 1. Rails 3 ..and the real secret to high productivity
  2. 2. 5 2004 - 2009
  3. 3. 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
  4. 4. We’re still here
  5. 5. The philosophy of Rails 3
  6. 6. The progress of Rails 3
  7. 7. New router Faster Route by subdomains, user agents, more Route to other Rack machinery
  8. 8. 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
  9. 9. 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
  10. 10. XSS protection
  11. 11. <%# => 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 %>
  12. 12. 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
  13. 13. JavaScript goes unobtrusive & agnostic
  14. 14. <%= 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>
  15. 15. <% 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;>
  16. 16. <%= 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>
  17. 17. <%= 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>
  18. 18. $(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(); } });
  19. 19. More agnosticism Action ORM Generators
  20. 20. The great refactoring Abstract Controller + Action Dispatch Action Relation underpins Active Record Cherry picking from Active Support Speedy callbacks
  21. 21. The real secret to high productivity
  22. 22. Renegotiate requirements
  23. 23. “Sure, whatever” Stakeholders every where
  24. 24. “I don’t know how” “It’s just too hard” “I’d be bored senseless” “That would kill the abstraction”
  25. 25. Programmer
  26. 26. Partner
  27. 27. Questions?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×