Rails 3
Upcoming SlideShare
Loading in...5
×
 

Rails 3

on

  • 3,181 views

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

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

Statistics

Views

Total Views
3,181
Views on SlideShare
3,132
Embed Views
49

Actions

Likes
1
Downloads
25
Comments
0

6 Embeds 49

http://rotterdam-rb.org 35
http://www.slideshare.net 8
http://feeds.feedburner.com 2
http://www.linkedin.com 2
https://resrc.squarespace.com 1
http://rtmrb.tumblr.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

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 Rails 3 Presentation Transcript

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