Installing and managing edge Rails

Share this article

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

Frequently Asked Questions (FAQs) about Installing and Managing Edge Rails

What is Edge Rails and how does it differ from Ruby on Rails?

Edge Rails is essentially the latest, un-released version of Ruby on Rails. It contains the most recent features and updates that are yet to be included in the official release. While Ruby on Rails is a stable version that is recommended for production environments, Edge Rails is more suitable for developers who want to experiment with the latest features or contribute to the Rails codebase.

How do I install Edge Rails?

Installing Edge Rails involves a few steps. First, you need to clone the Rails repository from GitHub to your local machine. Then, you need to navigate to the cloned directory and run the ‘bundle install’ command to install all the necessary dependencies. Finally, you can create a new Rails application using the ‘rails new’ command.

What are the prerequisites for installing Edge Rails?

Before installing Edge Rails, you need to have Ruby and RubyGems installed on your machine. You also need to have Git installed as you will be cloning the Rails repository from GitHub.

Can I use Edge Rails in a production environment?

While it’s technically possible to use Edge Rails in a production environment, it’s generally not recommended. Edge Rails contains the latest features and updates that are yet to be officially released and thoroughly tested. Therefore, it may contain bugs or unstable features that can cause issues in a production environment.

How do I update Edge Rails?

To update Edge Rails, you need to navigate to the directory where you cloned the Rails repository and run the ‘git pull’ command. This will fetch the latest changes from the repository. Then, you need to run the ‘bundle update’ command to update the dependencies.

How can I contribute to Edge Rails?

If you want to contribute to Edge Rails, you can fork the Rails repository on GitHub, make your changes, and then submit a pull request. Before contributing, it’s recommended to read the contributing guidelines provided by the Rails team.

What is the difference between Edge Rails and Rails stable version?

The main difference between Edge Rails and the stable version of Rails is that Edge Rails contains the latest, un-released features and updates, while the stable version contains features and updates that have been officially released and thoroughly tested.

Can I switch back to the stable version of Rails after installing Edge Rails?

Yes, you can switch back to the stable version of Rails after installing Edge Rails. You just need to specify the version of Rails you want to use when creating a new Rails application.

What are the benefits of using Edge Rails?

The main benefit of using Edge Rails is that you get to experiment with the latest features and updates before they are officially released. This can be particularly beneficial for developers who want to stay ahead of the curve and learn about the latest developments in Rails.

Are there any risks associated with using Edge Rails?

The main risk associated with using Edge Rails is that it may contain bugs or unstable features, as it contains the latest, un-released updates. Therefore, it’s generally not recommended for use in production environments.

Tim LucasTim Lucas
View Author
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week
Loading form