By request, I’ll give you a quick rundown on how to develop against the latest version of Rails. Why would you want to do this? You might be working on a brand new app that’ll be in development for a while, so stability is not a great concern. Maybe you wanna be the cool kid on the block playing with as-yet-unreleased features. Whatever the case, here’s how you do it.
By default, when you start a Rails app it attempts to use Rails from your project’s
vendor/rails directory. If it can not be found it’ll fall back on the latest gem.
To use edge Rails on an existing project, just do an
svn checkout of the rails trunk into your vendor/rails directory inside your project.
svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails
If you’re starting a new project, you can check out Rails from SVN and then use it to create your new project. All the following commands are for *nix-based platforms. If you’re a windows user you’ll have to adapt accordingly (and maybe leave a comment for others?)
mkdir -p cutting_edge_project/vendor cd cutting_edge_project svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails ruby vendor/rails/railties/bin/rails . ./script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) ...
If you want to sync your version of Rails with the latest version of SVN, just execute an svn update command on the rails directory (and don’t forget to restart your server).
svn update vendor/rails
If the trunk version of Rails is broken and you want to rollback to a specific revision, pass the revision to the update command with
svn update -r4598 vendor/rails
If you’re managing your project in SVN chances are you don’t want to check out the Rails trunk into your vendor directory, but instead you want to an
svn export or make use of
To create a new edge Rails that will be checked into SVN:
mkdir -p cutting_edge_svn_project/vendor cd cutting_edge_svn_project svn export http://dev.rubyonrails.org/svn/rails/trunk vendor/rails ruby vendor/rails/railties/bin/rails . rm -R vendor/rails # prepare project for SVN (i.e. delete logs, etc) and import
Once you’ve checked out a copy of your project, into say
my_checked_out_project, set the
svn:externals property of the vendor directory and do an
cd my_checked_out_project svn propset svn:externals "rails http://dev.rubyonrails.org/svn/rails/trunk" vendor svn update
You should now find that whenever you check out your project or do an SVN update it will update Rails as well. This is ok, but you’ll soon find you want a little more control over when you update to the latest version of Rails. To manually specify which revision of Rails you want use the
svn propset svn:externals "rails -r4859 http://dev.rubyonrails.org/svn/rails/trunk" vendor svn update
and just because Rails is meant to be easy, it ships with two Rake tasks to do this for you (though with the conundrum that you can only execute them if you’ve got a Rails project already created)
rake -T rails:freeze