RailsConf 2007 Opening Keynote: David Heinemeier Hansson

Posted by Nick Sieger Fri, 18 May 2007 17:10:39 GMT

Rails 2.0

Where we’ve been

David is surprised and proud of the community that we already have, and wants us to be comfortable with where we are, and not always looking toward the future. We have:

  • Million gem downloads
  • Hundreds of plugins
  • 10k users on the rubyonrails-talk mailing list
  • Ruby job descriptions (asking for 3 years RoR experience, longer than David)
  • Books, books, books (and not just English books, but non-English titles as well), surpassing VBA, Perl, and Python in book sales
  • IDEs from NetBeans, Borland, Aptana, etc.

Rails 2.0 is not going to be the “Unicorn”. It’s not going to be a total rewrite, it actually has a release schedule, it will not break backwards-compatibility. Instead, it will build upon what we already have, and continue the philosophy of building on what is useful and needed. In fact, 95% of what’s in 2.0 already works today, in the edge. Example, a simple controller that handles three formats of input/output, with a person resource for accessing the data from a remote server.

class PeopleController < ApplicationController
  ...
  def create
    @person = Person.create(...)
    respond_to do |format|
      format.html { redirect_to person_url(@person) }
      format.xml  { render :status => :created, :location => person_url(@person), ... }
      format.js {
        render :update do |js|
          ...
        end
      }
    end
  end
end

class Person < ActiveResource::Base
  self.site = "http://example.com/"
end

David then goes into a live demo of the new scaffold resource, which by appearance is identical to the old scaffolding, except it comes pre-baked with a REST-ful XML interface. He then adds support for a text format with a couple of lines of code, jumps into IRB, defines an active resource, and proceeds to change the data remotely.

If you want to add search to your controller, you can do it in a DRY way, and all the format/view work you’ve done will benefit:

class PeopleController < ApplicationController
  def index
    if params[:name]
      @people = Person.find :all, :conditions => ["name like ?", "#{params[:name]}%"]
    else
      @people = Person.find :all
    end
    ...
  end
end

David points out that 37signals, Shopify, Fluxiom, et. al. are real sites, with non-trivial domains that are still well executed in Rails, so it’s not just about simple scaffolding demos.

In Rails 2.0, ActiveResource will be bundled with Rails, and ActionWebService will not.

Friends of Rails

  • AJAX!
  • REST!
  • Atom? -- Atom should be more native to Rails
  • Openid? -- Openid is not necessarily something that needs to be used by all, but still a strong ally.

9 other things I like about Rails 2

  • Breakpoints are back -- no longer depends on Binding.of_caller; instead Rails depends and builds upon ruby-debug by Kent Sibilev.
  • HTTP Performance -- streamlining .js and .css, even though it feels better to break up Javascript and CSS into many little pieces, and gzip them
<%= javascript_include_tag :all, :cache => true %>
<%= stylesheet_link_tag :all, :cache => true %>

We can also fake out the browser and configure multiple asset hosts (4) you can maximize browser connections

config.action_controller.asset_host = 'assets%d.highrisehq.com'
  • Query cache
ActiveRecord::Base.cache do
  # actions here are cached
end
  • Rendering and MIME types -- bake the MIME convention into the template, and separate from the rendering mechanism people/index.html.erb people/index.xml.builder people/index.rss.erb people/index.atom.builder
  • config/initializers replacing config/environment. Initializers are .rb files in the config/initializers directory of your app that are automatically loaded during initialization time.
  • Sexy migrations
create_table :people do |t|
  t.integer :account_id
  t.string :first_name, :last_name, :null => false
  t.text :description
  t.timestamps
end
  • HTTP authentication (authenticate_or_request_with_http_basic, authenticate_with_http_basic)
  • The MIT assumption -- the licensing question -- make it easier to understand
  • Spring cleaning -- getting rid of the cruft -- stay tuned!

Tags ,  | 4 comments | no trackbacks

Comments

  1. Avatar D. Taylor Singletary said about 1 hour later:

    Thanks for summarizing this for those of us who couldn’t make it to the keynote.

  2. Avatar Logan Koester said about 14 hours later:

    Indeed, thank you.

  3. Avatar Akhil Bansal said 1 day later:

    Hey, Lots of new things to come in Rails2.0, Thanks for sharing.

  4. Avatar Bernd said 2 days later:

    Ha, I haven’t even learned 1,2.3 and yet curious to see 2.0 :-)

Trackbacks

Use the following link to trackback from your own site:
http://blog.nicksieger.com/articles/trackback/241