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 -r.
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 svn:externals.
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 svn update:
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 -r flag:
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
To sync your project’s javascript and config files with the Rails that’s in your vendor directory execute the following rake command:
rake rails:update # Update both configs, scripts and public/javascripts from Rails
Related posts:
- Famous Rails Screencast Gets an Update When Ruby on Rails was first introduced, nothing helped put...
- Top Ruby Frameworks Rails and Merb Join Forces It's not every day that two essentially competing web development...
- Installing PHP on Windows Just Got Easier Have you ever felt frustrated when setting up a PHP/MySQL...
- FullCodePress: WordPress vs Rails Raena and Matt are on the ground at the FullCodePress...
- The ABCs Of Managing A Team, Part I Here are some ways to promote a healthy, efficient and...







Thanks for this Tim, very useful. Especially about being able to rollback if edge is broken.
July 11th, 2006 at 12:44 pm
[...] Next step was to get on edge rails, and set that up as a svn:externals source — this guide is pretty clear, but there are others. It seems that right in the middle of the process, rubyonrails.org stopped responding, so I couldn’t actually test it. I decided to call it a night. [...]
August 8th, 2006 at 4:38 pm
sdfOctober 13th, 2006 at 8:23 am
this page locks up my browser (Firefox 1.5.0.7, UNIVERSAL OS X) if javascript is enabled :(
October 20th, 2006 at 3:36 pm
I think you shouldn’t set svn:externals on the vendor directory, only the rails subdirectory. Sometimes people have other stuff in there too.
October 26th, 2006 at 3:54 am
Anon: Sorry, not sure what’s causing that. I’ll forward on your feedback onto the web guys.
Sters: Not neccessarily. If you want more than one external defined in the vendor directory then you just separate each with a newline:
svn propset svn:externals "rails http://dev.rubyonrails.org/svn/rails/trunk redcloth http://code.whytheluckystiff.net/svn/redcloth/trunk/" vendorOnce you’ve got the grasp of using svn:externals you may also want to check out Piston, a tool that allows you to store the contents of the remote repository in your SVN and update it just as you would using straight svn:externals. Very handy.
October 26th, 2006 at 10:20 am
I think the string:
is malformed. I could only get it to work with the following:
I’m new to svn, is that correct, or did I do something bad?
December 4th, 2006 at 5:26 am
Trying this again:
I think the string:
<code>svn propset svn:externals “rails http://dev.rubyonrails.org/svn/rails/trunk vendor/rails” vendor </code>
is malformed. I could only get it to work with the following:
<code>svn propset svn:externals “rails http://dev.rubyonrails.org/svn/rails/trunk vendor/rails” vendor </code>
I’m new to svn, is that correct, or did I do something bad?
December 4th, 2006 at 5:34 am
Grrrr, the second string should be:
<code>svn propset svn:externals “rails http://dev.rubyonrails.org/svn/rails/trunk”; vendor/rails</code>
PS, it would be nice to add a “preview” option to the posts :)
December 4th, 2006 at 5:36 am
i can confirm that problem
causes:
December 27th, 2006 at 7:56 pm
“the ‘rails’ in the beginning of the quoted string sets the directory”
-jhubert
December 27th, 2006 at 8:01 pm
ack.
it should read:
svn propset svn:externals \"rails http://dev.rubyonrails.org/svn/rails/trunk\" vendorDecember 27th, 2006 at 8:05 pm
Sorry it took so long to edit this article. It should indeed read:
svn propset svn:externals "rails http://dev.rubyonrails.org/svn/rails/trunk" vendorFor an updated technique on managing edge Rails you can check out my more recent article: A clean slate, Edge Rails recipe
December 27th, 2006 at 8:52 pm
I am a windows user and this worked for me:
rails cutting_edge_project
cd cutting_edge_project
svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails
ruby vendor/rails/railties/bin/rails .
ruby script/server
January 24th, 2007 at 6:00 am
stormville: sure, that will work, as long as your project isn’t in SVN itself… otherwise you’re checking out the Rails repo in the middle of your own repo. It’s a good point though, doing
ruby vendor/rails/railties/bin/rails .from your vendor directory… though it could leave some unnecessary folders lying around from the previous ver of rails.January 24th, 2007 at 10:20 am
A more user friendly method of setting svn:externals is:
This will fire up whatever editor is stored in $SVN_EDITOR, where you can add your externals. Once you save and quit the editor, the new property values will be set.
April 19th, 2007 at 6:08 am
I’ve installed edge rails, but not seeing it being used. How is the vendor/rails path added? I’m using fast cgi. I have two rails directories, one with edge, and one without. They both display the same result with rails -v. I also added a ‘raise’ to to_xml, and it didn’t see it. I’m assuming rails -v will tell me the build number.
September 16th, 2007 at 12:38 am
Good one
Thanks a lot
November 19th, 2008 at 3:52 pm