0
Rails 2.0
“evolution, not revolution”
Rails 2.0 Overview
           RESTful web architectures

         some small feature maturations

removal of features dete...
Action Pack
ActionController + ActionView
Multiview
“Machine-Gunning .rhtml and .rxml”

    (action.mimetype.renderer)
             show.html.erb
           index.a...
Partial Layouts
Partial Layouts
Routing Resources
Routing Namespaces




         link_to ‘variants’,
admin_product_variants_url(@product)

   /admin/products/:product_id/v...
Record Identification
           redirect_to(person)
     link_to(person.name, person)
            form_for(person)
HTTP Authentication
authenticate_or_request_with_http_basic
Exception Handling
controllers/application.rb




             rescue_from
Atom Feed Helper
Stolen from the DHH announcement
Mime::Type Predicates
     controller.request.format.html?
     controller.request.format.xml?
Performance
   Asset Servers
   Asset Caching
Cookie Based Sessions
most browsers will only make up
to two simultaneous connections
       to any one domain


       Asset Servers
config/environment.rb




             Asset Servers
config/environment.rb




              Asset Servers
      will always use the same server for a single file
Asset Caching
Cookie Based Sessions
example stolen from ryan daigle




Cookie Sessions Security
Security
 CSRF Protection
TextHelper#sanitize
HTTP only cookies
CSRF Protection
Active Resource
Short Overview of Resources
A consumer of RESTful resources



     Active Resource
A consumer of RESTful resources
     As ActiveRecord is a consumer of
       relational database resources


     Active R...
ActiveResource Models
Active Resource Actions
                 Http REST   request
Model request                          Request URI         Re...
demo
Active Record
Validations
:allow_blank
validates_numericality
:allow_blank
validates_numericality
Sexy Migrations
“Cold Shower” Migrations
Err Sexy Migrations
Rails 2.0 Sexy
4 fewer lines + rails programmers == sexy
References
Query Cache
Query Cache Logging
Disabling the Query
       Cache
Fixtures
    Foxy Fixtures
 Collection Fixtures
Fixture Performance
conferences.yml




places.yml




             Foxy Fixtures
conferences.yml




places.yml




             Foxy Fixtures
Was




        Now




Collection Fixtures
Data Exchange
 to_xml, from_xml
 to_json, from_json
/conferences/show/1.js
to_json
to_xml
Other Stuff
rake
rake notes
rake notes
rake notes
rake db
  rake db:create
rake db:create:all
   rake db:drop
 rake db:drop:all
   rake db:reset
 rake db:rollback
 rake db:...
rake routes
rake routes
route name, HTTP method, route path, route requirements
helper :all
rails my_new_app
Request Profiler
               RubyProf Wrapper

./script/performance/request -n 10 login_session.rb
/config/initializers/
initializers directory
initializers directory
initializers directory
config/preinitializer.rb
 loaded before the environment files
Scaffolding
        ./script/generate scaffold conference
name:string description:text start_date:date end_date:date
Resourceful Scaffolding
Breakpoints
gem install ruby-debug
add ‘debugger’ to code
./script/server -u
demo
www.datanoise.com/ruby-debug
Upgrading to 2.0
Deprecations
with_scope
Components
Pagination
Object Transactions
http://code.bitsweat.net/svn/object_transactions/
ActionWebService
    ActiveResource
syntax changes
  @params           params[]
  @session          session[]
   @flash              flash[]
  @request         ...
start_form_tag
end_form_tag


form_for do
end
start_form_tag
end_form_tag


form_tag
</form>
Extracting to Plugins
     and Gems
            acts_as
       some js helpers
  commercial database adapters
./script/plugin install
   acts_as_list
   acts_as_nested_set
   acts_as_tree
   auto_complete
   in_place_editing
gem install
activerecord-X-adapter
   --source http://gems.rubyonrails.com

               firebird
             frontbase
...
Upgrade Process

 gem install rails -y
Resources
•   Peepcode Rails2 PDF - Ryan Daigle ($9)
•   http://weblog.rubyonrails.org
    •   /2007/12/7/rails-2-0-it-s-d...
Thanks!
noesbueno.org/rails2
Work with me @
         http://www.reactrix.com/careers.php
                 schacon@gmail.com



        Sr. Web Develope...
Rails 2.0 Presentation
Rails 2.0 Presentation
Rails 2.0 Presentation
Rails 2.0 Presentation
Rails 2.0 Presentation
Rails 2.0 Presentation
Rails 2.0 Presentation
Upcoming SlideShare
Loading in...5
×

Rails 2.0 Presentation

9,307

Published on

These are the slides from my presentation on Rails 2.0 at the Silicon Valley Ruby on Rails Meetup on Dec 13.

Published in: Business, Technology
0 Comments
12 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,307
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
376
Comments
0
Likes
12
Embeds 0
No embeds

No notes for slide

Transcript of "Rails 2.0 Presentation"

  1. 1. Rails 2.0 “evolution, not revolution”
  2. 2. Rails 2.0 Overview RESTful web architectures some small feature maturations removal of features determined to be not essential
  3. 3. Action Pack ActionController + ActionView
  4. 4. Multiview “Machine-Gunning .rhtml and .rxml” (action.mimetype.renderer) show.html.erb index.atom.builder edit.iphone.haml
  5. 5. Partial Layouts
  6. 6. Partial Layouts
  7. 7. Routing Resources
  8. 8. Routing Namespaces link_to ‘variants’, admin_product_variants_url(@product) /admin/products/:product_id/variants
  9. 9. Record Identification redirect_to(person) link_to(person.name, person) form_for(person)
  10. 10. HTTP Authentication
  11. 11. authenticate_or_request_with_http_basic
  12. 12. Exception Handling
  13. 13. controllers/application.rb rescue_from
  14. 14. Atom Feed Helper
  15. 15. Stolen from the DHH announcement
  16. 16. Mime::Type Predicates controller.request.format.html? controller.request.format.xml?
  17. 17. Performance Asset Servers Asset Caching Cookie Based Sessions
  18. 18. most browsers will only make up to two simultaneous connections to any one domain Asset Servers
  19. 19. config/environment.rb Asset Servers
  20. 20. config/environment.rb Asset Servers will always use the same server for a single file
  21. 21. Asset Caching
  22. 22. Cookie Based Sessions
  23. 23. example stolen from ryan daigle Cookie Sessions Security
  24. 24. Security CSRF Protection TextHelper#sanitize HTTP only cookies
  25. 25. CSRF Protection
  26. 26. Active Resource Short Overview of Resources
  27. 27. A consumer of RESTful resources Active Resource
  28. 28. A consumer of RESTful resources As ActiveRecord is a consumer of relational database resources Active Resource
  29. 29. ActiveResource Models
  30. 30. Active Resource Actions Http REST request Model request Request URI Response operation body find(id) GET n/a /people/id.xml <XML> Status: save (update) PUT <XML> /people/id.xml 200 OK Location: save (create) POST <XML> /people http://x/people/id.xml Status: destroy DELETE n/a /people/id.xml 200 OK list GET n/a /people <XML> credit: ryan diagle
  31. 31. demo
  32. 32. Active Record
  33. 33. Validations
  34. 34. :allow_blank validates_numericality
  35. 35. :allow_blank validates_numericality
  36. 36. Sexy Migrations
  37. 37. “Cold Shower” Migrations
  38. 38. Err Sexy Migrations
  39. 39. Rails 2.0 Sexy 4 fewer lines + rails programmers == sexy
  40. 40. References
  41. 41. Query Cache
  42. 42. Query Cache Logging
  43. 43. Disabling the Query Cache
  44. 44. Fixtures Foxy Fixtures Collection Fixtures Fixture Performance
  45. 45. conferences.yml places.yml Foxy Fixtures
  46. 46. conferences.yml places.yml Foxy Fixtures
  47. 47. Was Now Collection Fixtures
  48. 48. Data Exchange to_xml, from_xml to_json, from_json
  49. 49. /conferences/show/1.js to_json
  50. 50. to_xml
  51. 51. Other Stuff
  52. 52. rake
  53. 53. rake notes
  54. 54. rake notes
  55. 55. rake notes
  56. 56. rake db rake db:create rake db:create:all rake db:drop rake db:drop:all rake db:reset rake db:rollback rake db:version
  57. 57. rake routes
  58. 58. rake routes route name, HTTP method, route path, route requirements
  59. 59. helper :all
  60. 60. rails my_new_app
  61. 61. Request Profiler RubyProf Wrapper ./script/performance/request -n 10 login_session.rb
  62. 62. /config/initializers/
  63. 63. initializers directory
  64. 64. initializers directory
  65. 65. initializers directory
  66. 66. config/preinitializer.rb loaded before the environment files
  67. 67. Scaffolding ./script/generate scaffold conference name:string description:text start_date:date end_date:date
  68. 68. Resourceful Scaffolding
  69. 69. Breakpoints
  70. 70. gem install ruby-debug
  71. 71. add ‘debugger’ to code
  72. 72. ./script/server -u
  73. 73. demo
  74. 74. www.datanoise.com/ruby-debug
  75. 75. Upgrading to 2.0
  76. 76. Deprecations
  77. 77. with_scope
  78. 78. Components
  79. 79. Pagination
  80. 80. Object Transactions
  81. 81. http://code.bitsweat.net/svn/object_transactions/
  82. 82. ActionWebService ActiveResource
  83. 83. syntax changes @params params[] @session session[] @flash flash[] @request request[] @env env[] find_all find(:all) find_first find(:first) render_partial render :partial :post => true :method => :post
  84. 84. start_form_tag end_form_tag form_for do end
  85. 85. start_form_tag end_form_tag form_tag </form>
  86. 86. Extracting to Plugins and Gems acts_as some js helpers commercial database adapters
  87. 87. ./script/plugin install acts_as_list acts_as_nested_set acts_as_tree auto_complete in_place_editing
  88. 88. gem install activerecord-X-adapter --source http://gems.rubyonrails.com firebird frontbase informix openbase oracle sqlserver sybase
  89. 89. Upgrade Process gem install rails -y
  90. 90. Resources • Peepcode Rails2 PDF - Ryan Daigle ($9) • http://weblog.rubyonrails.org • /2007/12/7/rails-2-0-it-s-done • http://ryandaigle.com • /articles/2007/12/7/rails-2-0-final-released-summary-of-features • http://www.slashdotdash.net • /articles/2007/12/03/rails-2-upgrade-notes
  91. 91. Thanks! noesbueno.org/rails2
  92. 92. Work with me @ http://www.reactrix.com/careers.php schacon@gmail.com Sr. Web Developer Linux Systems Administrator Sr. Game/Interaction Programmer Computer Vision Engineer
  1. A particular slide catching your eye?

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

×