$30 off During Our Annual Pro Sale. View Details »

Why Should I Care About Rails 4?

Why Should I Care About Rails 4?

A talk about the upcoming features in Rails 4, and where Rails is going.

Steve Klabnik

October 05, 2012
Tweet

More Decks by Steve Klabnik

Other Decks in Programming

Transcript

  1. Why should I
    care about
    Rails 4?
    @steveklabnik
    Monday, October 8, 12

    View Slide

  2. Monday, October 8, 12

    View Slide

  3. Monday, October 8, 12

    View Slide

  4. Tons of stuff!
    (ʏ´ωʆ)ਓ(´ωʆʏ).
    Monday, October 8, 12

    View Slide

  5. Mass Extraction
    ➡page and
    action caching
    ➡rack-cache
    ➡observers
    ➡session store
    ➡mass
    assignment
    ➡active
    resource
    Monday, October 8, 12

    View Slide

  6. Strong parameters
    class PeopleController < ActionController::Base
    # throws ActiveModel::ForbiddenAttributes exception
    def create
    Person.create(params[:person])
    end
    private
    # now it won’t!
    def person_params
    params.require(:person).permit(:name, :age)
    end
    end
    Monday, October 8, 12

    View Slide

  7. Rails::Queueing
    # job.respond_to?(:run)
    # => true
    Rails.queue.push(job)
    Monday, October 8, 12

    View Slide

  8. Rails::Queueing
    class AsyncMailer < BaseMailer
    end
    Monday, October 8, 12

    View Slide

  9. Rails::Queueing
    class ActionMailer::Base
    class_attribute :queue
    self.queue = ActiveSupport::SynchronousQueue.new
    end
    Monday, October 8, 12

    View Slide

  10. class MyController < ActionController::Base
    include ActionController::Live
    def index
    100.times {
    response.stream.write "hello world\n"
    }
    response.stream.close
    end
    end
    ActionController::Live
    Monday, October 8, 12

    View Slide

  11. (¬_¬)
    Monday, October 8, 12

    View Slide

  12. Routing Concerns
    BCX::Application.routes.draw do
    resources :messages { resources :comments }
    resources :forwards { resources :comments }
    resources :uploads { resources :comments }
    end
    BCX::Application.routes.draw do
    concern :commentable do
    resources :comments
    end
    resources :messages, :forwards, :uploads, concerns: :commentable
    end
    Monday, October 8, 12

    View Slide

  13. Concerns
    app/models/concerns
    Monday, October 8, 12

    View Slide

  14. Cache Digests
    Monday, October 8, 12

    View Slide

  15. (ʗɻʘ)
    Monday, October 8, 12

    View Slide

  16. Cache Digests
    <% cache project do %>
    Monday, October 8, 12

    View Slide

  17. TURBO
    LINKS
    Monday, October 8, 12

    View Slide

  18. Turbolinks
    $(document).ready ->
    alert "page has loaded!"
    $(document).bind "page:change", ->
    alert "page has loaded!"

    No turbolinks here
    .
    Monday, October 8, 12

    View Slide

  19. MAX
    SPEED
    Monday, October 8, 12

    View Slide

  20. Related:
    Monday, October 8, 12

    View Slide

  21. Rails Versioning
    (~> ‘shifted’ SemVer)
    Monday, October 8, 12

    View Slide


  22. 4.0.0: Easy upgrade, new features, new deprecations

    4.0.x: no new deprecations

    4.1.0: add features, remove deprecated stuff
    Monday, October 8, 12

    View Slide

  23. When’s it going
    to be released?
    Monday, October 8, 12

    View Slide

  24. “When It’s Ready”
    I hope it’s ready this year.
    Monday, October 8, 12

    View Slide

  25. Why should I
    care about
    Rails 4?
    Monday, October 8, 12

    View Slide

  26. Why should I
    care about
    Rails?
    Monday, October 8, 12

    View Slide

  27. “Rails is the
    best web
    framework 2005
    has to offer”
    Monday, October 8, 12

    View Slide

  28. Monday, October 8, 12

    View Slide

  29. ?
    Monday, October 8, 12

    View Slide

  30. Monday, October 8, 12

    View Slide

  31. Monday, October 8, 12

    View Slide

  32. Monday, October 8, 12

    View Slide

  33. Monday, October 8, 12

    View Slide

  34. Monday, October 8, 12

    View Slide

  35. “But what distinguishes the worst architect
    from the best of bees is this, that the architect
    raises his structure in imagination before he
    erects it in reality. ... Besides the exertion of the
    bodily organs, the process demands that, during
    the whole operation, the workman’s will be
    steadily in consonance with his purpose. This
    means close attention.”
    - Marx, Capital I, Chapter 7
    Monday, October 8, 12

    View Slide

  36. I am
    excite
    Monday, October 8, 12

    View Slide

  37. Why should I
    care about
    Rails 4?
    @steveklabnik
    Monday, October 8, 12

    View Slide