Year of Rails Innovation, Recap

The Rails Envy guys—Gregg Pollack and Jason Seifer—gave a fantastic talk at RailsConf on Friday about all the great Rails apps, tools and plugins that have been released in the past year. Their talk was very thorough and covered a lot of ground, and I thought it was worth mentioning some highlights here.

Ruby and Rails IDEs

Personally, I use TextMate, but I know a lot of Java developers who won’t ever make the switch to Rails without an IDE that has all the features they’re currently used to. RubyMine, from JetBrains, looks like it could be that editor.

First, transitioning to RubyMine from your current editor while retaining your shortcuts is easy. RubyMine lets you set the keymap to match that of Eclipse, Textmate and others. So there’s no need to relearn shortcuts. Getting started just requires you to specify your Ruby interpreter and the version of Rails you’re using.

You can run your server in the IDE, which allows you access to the console and server log and has a version control pane that works with Git. The Git pane lets you track changes, view diffs and commit all via the UI.

Type-aware auto-complete does neat things like list all your instance variables when you type @, or look up your database schema and give you a completion list of the db fields defined in your migrations. It will even give you an error if you type a field that doesn’t exist in your database.

Another interesting feature is the ability to switch from a traditional, file navigation tree to a “Rails layout” which displays your application by controllers, models, views and database calls. It also generates graphical layouts of your database schema, relationships or columns, so you can print out dependency diagrams.

If anyone is currently using RubyMine for development, especially in a team, I’d be very interested in getting your feedback on how it’s working for you.

Rack and Metal

Gregg did a deep dive into Rack for Rails, looking at what middlewares.rb does and summarized it:

  • Creates a lock around the request
  • Rescues with a last resort 500 error
  • Persists session information
  • Parses params from XML/JSON
  • Sets proper method
  • Clears body with Head Requests

He also called on the community to innovate more around Rack middleware and to optimize or replace the middleware in the existing stack.

Metal is for optimizing actions using Rack. Gregg showed some performance benchmarks where Metal significantly increased performance, even more so without ActiveRecord.

Improve Your Code and Code Testing

Jason and Gregg moved quickly through a large list of tools that make development more efficient. Many of these, including Rack and Metal, were also discussed in other sessions at RailsConf, but if you aren’t familiar with any of them, it’s worth taking a look:

  • Write-through caching, using Cache Money, to solve replication lag.
  • Rails templates to generate your rails app, install gems, plugins, etc. See youvegotrails.com and railsboost.com for Rails template generators.
  • Flay finds code duplication in your project.
  • Flog finds overly complex code.
  • Roodi parses your code and warns you about design problems.
  • Reek identifies code smell.
  • Metric Fu is a suite of tools (that includes Flay, Roodi and Reek) and also provides code churn analysis and code coverage reports.
  • Cucumber lets you set up BDD testing scenarios using plain language.
  • FakeWeb is a helper for faking requests in Ruby.
  • Spike analyzes your Rails logs.
  • UltraSphinx provides great full text search. Update: UltraSphinx has been deprecated in favor of Thinking Sphinx. Here’s the thread. You can still use UltraSphinx if it works for you, but there will be no new features added. Thanks Paul!
  • Sliding Stats provides application stats.
  • Sprinkle provisions servers.
  • Spree is an incredibly easy way to set up a shopping cart.
  • Taps is a Sinatra app that lets you easily migrate your db from one server to another.

If I’ve left anything significant out, let me know. If you missed this session, I highly recommend looking at their slides when they’re posted.