Michael Buffington has just opened up llor.nu for general consumption. It’s an open source board game built on Rails. Besides the hosted version, you can download the source and Michael is looking for merry contributors as well. Check it out.
Comrades, we are so close to the goal that the relieve should be tastable. The mythical 1.0 release is now penned to be the very next release once we rattle out the heinous bugs from this one. So we need every man, woman, and child at work testing the living daylights out of this final release candidate. Upgrade your apps, start new ones, kick the tires, rev the engine, do it all!
So what’s new? What’s in there to make it pay to upgrade today rather than at 1.0? Lots! In a regular universe, this would have counted as more than merely a 0.0.1 increment. We got a ton of stuff especially for Active Record and the Rails infrastructure.
The new commands
- script/server: Will now use lighttpd/FCGI if both are available on the system. This makes for a considerably faster development experience than WEBrick, but is unfortunately a OS X/nix thing only. Windows users will continue to get a WEBrick-powered server launched.
- script/plugin: Your gateway to the wonderful world of plugins. Helps you install, manage, and discover new plugins. See script/plugin —help for more.
- script/about: Gives you the all the versions for Rails and associates. See the sample.
Active Record: find_or_create_by_X, association collection extensions, migrations for all databases
We’ve added a new dynamic finder that allows you to find or create a new record on the basis of attributes passed, such as saying Tag.find_or_create_by_name(“Summer”). It even works on associations, so page.tags.find_or_create_by_name(“Summer”) is kosher too.
Extensions for association collections is a sexy new way of adding methods to the proxies that all access delegate through. Example:
class Account < ActiveRecord::Base has_many :people do def find_or_create_by_name(name) first_name, *last_name = name.split last_name = last_name.join " " find_or_create_by_first_name_and_last_name(first_name, last_name) end end end person = Account.find(:first).people.find_or_create_by_name("David Heinemeier Hansson") person.first_name # => "David" person.last_name # => "Heinemeier Hansson"
And finally we’ve really put the spit and polish on the database adapters by adding migration support to all the commercial ones. As well as giving especially the SQL Server one a good loving in general.
Action Pack: Better filter controls, fixed ActiveRecordStore, and redirect_to :back
Action Controller now has skip_before_filter and skip_after_filter to sidestep certain filters set in superclasses that doesn’t apply to the current controller. Such as specifying :authenticate in ApplicationController, but skiping it in the SignupController.
The ActiveRecordStore no longer only saves when changes have occured, so you can again rely on updated_at being incremented at each page view, and thus rely on it for garbage collection.
Finally we now have an easy way of saying “go back to where you came from” with redirect_to :back.
Upgrading from 0.14.x
It has never been so easy to upgrade to the latest and greatest if you’re on 0.14.x series. You get almost all of it for free simply by installing the latest gems and the rest by running these two commands:
I’ll let you figure out what those do.
Upgrading from 0.13.x (or earlier)
Jeremy Kemper has put together a great guide to upgrading from an earlier version.
What else is new?
As usual, you get the full play-by-play story of the changes by examining the changelogs. Such wonderful bedtime reading.
Liquid is a brand new template engine optimized for xhtml and emails. It features a very clean syntax and speedy execution speeds. The main difference to traditional ERb is that it does not rely on eval. This means that no potentially harmful code is executed when a Liquid template is compiled or rendered.
The chief advantage is that you can let your users change templates without having to worry about your data’s security. The templates only see data which you export to them. In Shopify for example you will be able to edit your shop’s templates and emails directly in the admin interface. The templates are stored in the database and rendered directly from it.
Liquid is packaged as a rails plugin for easy installation. In good rails style there is a small movie available showing how to install and use it.
If you’re working on patches for Rails, you should sign up for the rails-core mailing list. It’s much more low-traffic than the regular Rails mailing list and designated exclusively for discussions on extending Rails.
So if you have any questions about a patch you’re working on or have completed, this is the place to join. If you have questions of the usage of Rails, announcements, or any of the other jazz, please do keep it on the regular list.
O’Reilly’s XML.com has a new article entitled REST on Rails that explores the building of a simple REST-based web service. They even finish up with a tad of meta-programming to wrap their approach nicely.
RadRails is getting company from commercial player ActiveState that has recently shipped Komodo 3.5, their IDE for dynamic languages. Komodo features support for Ruby and Rails and is available on Windows, Linux, and Mac OS X.
Komodo Professional is a $295 buy, Komodo personal is $29.95, and there’s a 21-day trial available.
The release got a bit of play in the press with an InfoWorld article called Ruby IDE is set to shine.
Being a OS X/TextMate user myself, I haven’t had a chance to checkout Komodo. Please do add your experiences in the comments for others to share.
Maik Schmidt is the contributor and maintainer of the DB2 database adapter for Active Record. He’s now also an author of Enterprise Integration with Ruby, which has just been released as a beta book under the Pragmatic Bookshelf.
Learn all about how to wire enterprise and legacy systems together using Ruby, databases, LDAP, XML, sockets, HTTP, web services, Web Services™, and more. There’s a free chapter on LDAP available, you can checkout the table of contents, and of course buy the beta book in PDF for $20 or at $37.45 for a paper-when-ready + PDF combo.
Way to go Maik.
Stefan Kaes has been untiringly pushing for optimizations of Rails. Since the release of Rails 0.12.1, Stefan has lead an effort that made his own sample application no less than 4 times faster with Rails 0.14.×. Pretty impressive stuff.
Now he’s blogging about Rails performance in general at RailsExpress.blog. So be sure to subscribe to that feed if you care about a faster Rails. He already has suggestions and benchmarks up on sessions and pagination.
If you have any sliver of design skill in your bone, you’d be well advised to participate in this content. Oh, and the upshot is that Typo gets a legion of cool new themes out of it too. See, everybody wins!
eWEEK has another cool article on the growth of Ruby on Rails. Including comments from ActiveState and JBoss. Good stuff.