Take me home

How to go edge

Written by August Lilleaas, published December 02, 2007

People get confused when freezing their 1.2.x Rails app to edge. Here’s how to do it properly.

Basically, this is how you freeze an app to edge (edge is what cool kids are saying when they refer to the latest trunk/development version of Rails):

rake rails:freeze:edge

It adds the entire Rails framework to the vendor/rails directory (as opposed to where-ever-your-gems-is-installed).

However. When you create a new, blank rails app, you use the rails command. It creates a bunch of files, which basically is the “rails framework” itself. This includes the config files environment.rb, routes.rb, the directory/folder structure, .htaccess-files and so on.

Thing is, those files have changed from 1.2.x to 2.0. If you freeze the app and try to initialize it, you’ll get all sorts of error. The rails version in vendor/rails doesn’t match up with the rails app you generated from your local version – 1.2.x.

To fix this, run the following command:

ruby vendor/rails/railities/bin/rails .

This runs the rails-command of the recently checked out edge version, on your outdated 1.2.x app, and updates all them files to the edge versions.

Make sure you overwrite all the files. Either select “y” every time you get prompted for an overwrite, or just go “a” the first time you get prompted, and have it overwrite everything.

If you already have custom stuff in, say, the application controller, environment.rb etc, do this:

  1. make a backup of your app (or do nothing if you’re version controlling it with SVN or whatever)
  2. run the command, and overwrite all files
  3. update these blank-slate files with the stuff you had in them before the update, making sure you don’t remove anything from these newly generated files unless you know what you’re doing

You most likely got a new config/initializers directory, a neat protect_from_forgery method in the application controller, a very phat cookie session storage in your config/environment.rb and lots of more 2.0 coolness.


Questions or comments?

Feel free to contact me on Twitter, @augustl, or e-mail me at august@augustl.com.