0
Rails  3 A Quick Tour by @iain_nl
disclaimer Any content of these slides might already be outdated, we're talking beta here...
Contents <ul><ul><li>Philosophy </li></ul></ul><ul><ul><li>Code design </li></ul></ul><ul><ul><li>Modularity </li></ul></u...
1. Philisophy <ul><ul><li>Rails merges with Merb </li></ul></ul><ul><ul><li>The Great Refactor TM </li></ul></ul><ul><ul><...
2. Code Design <ul><ul><li>Namespaced  config/application.rb </li></ul></ul><ul><li>module MyApp </li></ul><ul><li>    cla...
3. Modularity <ul><ul><li>opt out  config/application.rb </li></ul></ul><ul><li>require &quot;rails/all&quot; </li></ul><u...
4. ActiveSupport <ul><ul><li>Cherry Picking! </li></ul></ul><ul><li>require 'active_support/core_ext/array/wrap' </li></ul...
5. ActiveModel <ul><ul><li>Modular and reusable </li></ul></ul><ul><li>class PostPresenter </li></ul><ul><li>   include Ac...
6. ActionController <ul><ul><li>Inheritence and abstraction </li></ul></ul><ul><ul><li>Reusable modules </li></ul></ul><ul...
7. Plugin API <ul><ul><li>Every Rails Component is a Rails plugin </li></ul></ul><ul><ul><li>Eat your own dog food </li></...
8. Router <ul><ul><li>Exposes your Rack </li></ul></ul><ul><li>MyApp::Application.routes do </li></ul><ul><li>   constrain...
9. HTML Safety <ul><ul><li>Our helpers: </li></ul></ul><ul><ul><ul><li>h </li></ul></ul></ul><ul><ul><ul><li>raw </li></ul...
10. Bundler <ul><ul><li>Gem dependencies </li></ul></ul><ul><ul><li>Calculate versions beforehand </li></ul></ul><ul><ul><...
11. Concerns <ul><ul><li>Rails plugins or gems are broken by design </li></ul></ul><ul><ul><li>Backwards compatibility is ...
12. Conclusion <ul><ul><li>Looks great </li></ul></ul><ul><ul><li>Doesn't feel great yet </li></ul></ul><ul><ul><li>Play, ...
The End Please, don't forget the guide
Upcoming SlideShare
Loading in...5
×

Rails 3

2,232

Published on

A Quick Tour of some of the new Ruby on Rails 3 features, given march 8th 2010 on a rotterdam-rb.org meeting.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,232
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
26
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Rails 3"

  1. 1. Rails 3 A Quick Tour by @iain_nl
  2. 2. disclaimer Any content of these slides might already be outdated, we're talking beta here...
  3. 3. Contents <ul><ul><li>Philosophy </li></ul></ul><ul><ul><li>Code design </li></ul></ul><ul><ul><li>Modularity </li></ul></ul><ul><ul><li>ActiveSupport </li></ul></ul><ul><ul><li>ActiveModel </li></ul></ul><ul><ul><li>ActionController </li></ul></ul><ul><ul><li>Plugin API </li></ul></ul><ul><ul><li>Router </li></ul></ul><ul><ul><li>HTML safety </li></ul></ul><ul><ul><li>Bundler </li></ul></ul><ul><ul><li>Concerns </li></ul></ul><ul><ul><li>Conclusion </li></ul></ul>
  4. 4. 1. Philisophy <ul><ul><li>Rails merges with Merb </li></ul></ul><ul><ul><li>The Great Refactor TM </li></ul></ul><ul><ul><li>Sanity </li></ul></ul><ul><ul><li>Modular </li></ul></ul><ul><ul><li>Performance </li></ul></ul>
  5. 5. 2. Code Design <ul><ul><li>Namespaced config/application.rb </li></ul></ul><ul><li>module MyApp </li></ul><ul><li>   class Application < Rails::Application </li></ul><ul><li>     # your config here </li></ul><ul><li>   end </li></ul><ul><li>end </li></ul><ul><ul><li>Rack up  config.ru </li></ul></ul><ul><li>require ::File.expand_path('../config/environment',  __FILE__) </li></ul><ul><li>run MyApp::Application </li></ul><ul><ul><li>Clean boot process config/boot.rb </li></ul></ul><ul><li>begin </li></ul><ul><li>   require File.expand_path('../../.bundle/environment', __FILE__) </li></ul><ul><li>rescue LoadError </li></ul><ul><li>   require 'rubygems' </li></ul><ul><li>   require 'bundler' </li></ul><ul><li>   Bundler.setup </li></ul><ul><li>end </li></ul>
  6. 6. 3. Modularity <ul><ul><li>opt out config/application.rb </li></ul></ul><ul><li>require &quot;rails/all&quot; </li></ul><ul><li># require &quot;action_controller/railtie&quot; </li></ul><ul><li># require &quot;action_mailer/railtie&quot; </li></ul><ul><li># require &quot;active_resource/railtie&quot; </li></ul><ul><li># require &quot;rails/test_unit/railtie&quot; </li></ul><ul><li>config.generators do |g| </li></ul><ul><li>   g.orm             :active_record </li></ul><ul><li>   g.template_engine :erb </li></ul><ul><li>   g.test_framework  :test_unit, :fixture => true </li></ul><ul><li>end </li></ul><ul><ul><li>Generators rails generate </li></ul></ul><ul><li>Erb: </li></ul><ul><li>   erb:controller </li></ul><ul><li>   erb:mailer </li></ul><ul><li>   erb:scaffold </li></ul><ul><li>Haml: </li></ul><ul><li>   haml:controller </li></ul><ul><li>   haml:mailer </li></ul><ul><li>   haml:scaffold </li></ul>
  7. 7. 4. ActiveSupport <ul><ul><li>Cherry Picking! </li></ul></ul><ul><li>require 'active_support/core_ext/array/wrap' </li></ul><ul><li>require 'active_support/core_ext/benchmark' </li></ul><ul><li>require 'active_support/core_ext/exception' </li></ul><ul><li>require 'active_support/core_ext/class/attribute_accessors' </li></ul><ul><li>require 'active_support/core_ext/object/to_param' </li></ul><ul><li>require 'active_support/core_ext/string/inflections' </li></ul><ul><li>module ActiveSupport </li></ul><ul><li>   module Cache </li></ul><ul><li>     # etc.... </li></ul><ul><li>   end </li></ul><ul><li>end </li></ul>
  8. 8. 5. ActiveModel <ul><ul><li>Modular and reusable </li></ul></ul><ul><li>class PostPresenter </li></ul><ul><li>   include ActiveModel::Validations </li></ul><ul><li>   include ActiveModel::Dirty </li></ul><ul><li>   include ActiveModel::StateMachine </li></ul><ul><li>end </li></ul><ul><ul><li>The integration API </li></ul></ul><ul><li>class LintTest < ActiveModel::TestCase </li></ul><ul><li>   include ActiveModel::Lint::Tests </li></ul><ul><li>   def setup </li></ul><ul><li>     @model = Sequel::Document.new </li></ul><ul><li>   end </li></ul><ul><li>end </li></ul><ul><ul><li>Cleaner Syntax </li></ul></ul><ul><li>Article.where(&quot;published_at <= ?&quot;, Time.now).includes(:comments) </li></ul><ul><ul><ul><li>Railscast 202 </li></ul></ul></ul>
  9. 9. 6. ActionController <ul><ul><li>Inheritence and abstraction </li></ul></ul><ul><ul><li>Reusable modules </li></ul></ul><ul><li>module ActionController </li></ul><ul><li>   class Base < Metal </li></ul><ul><li>     include AbstractController::Callbacks </li></ul><ul><li>     include AbstractController::Layouts </li></ul><ul><li>     include AbstractController::Translation </li></ul><ul><li>     include ActionController::Helpers </li></ul><ul><li>     include ActionController::UrlFor </li></ul><ul><li>     include ActionController::Redirecting </li></ul><ul><li>     include ActionController::Rendering </li></ul><ul><li>     include ActionController::Renderers::All </li></ul><ul><li># etc... </li></ul>
  10. 10. 7. Plugin API <ul><ul><li>Every Rails Component is a Rails plugin </li></ul></ul><ul><ul><li>Eat your own dog food </li></ul></ul><ul><li>module ActiveRecord </li></ul><ul><li>   class Railtie < Rails::Railtie </li></ul><ul><li>     railtie_name :active_record </li></ul><ul><li>     config.generators.orm :active_record, :migration => true, </li></ul><ul><li>                                           :timestamps => true </li></ul><ul><li>     rake_tasks do </li></ul><ul><li>       load &quot;active_record/railties/databases.rake&quot; </li></ul><ul><li>     end </li></ul><ul><li>     initializer &quot;active_record.logger&quot; do </li></ul><ul><li>       ActiveRecord.base_hook { self.logger ||= ::Rails.logger } </li></ul><ul><li>     end </li></ul><ul><li>   end </li></ul><ul><li>end </li></ul>
  11. 11. 8. Router <ul><ul><li>Exposes your Rack </li></ul></ul><ul><li>MyApp::Application.routes do </li></ul><ul><li>   constraints :subdomain => &quot;support&quot; do </li></ul><ul><li>     match &quot;/foo/bar&quot;, :to => &quot;foo#bar&quot; </li></ul><ul><li>     match &quot;/baz&quot;, :to => MyOtherRackApp </li></ul><ul><li>   end </li></ul><ul><li> scope &quot;(/:locale)&quot; do </li></ul><ul><li>resources :users do </li></ul><ul><li>resources :posts </li></ul><ul><li>end </li></ul><ul><li>end </li></ul><ul><li>end </li></ul><ul><ul><li>Railscast 203 </li></ul></ul>
  12. 12. 9. HTML Safety <ul><ul><li>Our helpers: </li></ul></ul><ul><ul><ul><li>h </li></ul></ul></ul><ul><ul><ul><li>raw </li></ul></ul></ul><ul><ul><ul><li>html_safe? </li></ul></ul></ul><ul><ul><ul><li>html_safe </li></ul></ul></ul><ul><ul><li>ERb stringbuffer is aware of html safety </li></ul></ul><ul><ul><li>Railscast 204 </li></ul></ul>
  13. 13. 10. Bundler <ul><ul><li>Gem dependencies </li></ul></ul><ul><ul><li>Calculate versions beforehand </li></ul></ul><ul><ul><li>Update your rvm and passenger </li></ul></ul><ul><ul><li>Rails independent </li></ul></ul><ul><ul><li>Railscast 201 </li></ul></ul><ul><li>source &quot;http://rubygems.org&quot; </li></ul><ul><li>gem &quot;rails&quot;, &quot;3.0.0.beta&quot; </li></ul><ul><li>gem &quot;cutting_edge_gem&quot;, :git => &quot;git://github.com/...&quot; </li></ul><ul><li>group :test do </li></ul><ul><li>   gem &quot;rspec&quot;, &quot;2.0.0.beta3&quot; </li></ul><ul><li>   gem &quot;cucumber&quot; </li></ul><ul><li>end </li></ul>
  14. 14. 11. Concerns <ul><ul><li>Rails plugins or gems are broken by design </li></ul></ul><ul><ul><li>Backwards compatibility is gone </li></ul></ul><ul><ul><li>Many, many changes </li></ul></ul><ul><ul><li>Beta feels alpha </li></ul></ul><ul><ul><li>New source code has few comments </li></ul></ul>
  15. 15. 12. Conclusion <ul><ul><li>Looks great </li></ul></ul><ul><ul><li>Doesn't feel great yet </li></ul></ul><ul><ul><li>Play, but don't upgrade just yet </li></ul></ul>
  16. 16. The End Please, don't forget the guide
  1. A particular slide catching your eye?

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

×