How to get an application to use a local branch version of Ruby on Rails
Let's say I want to add some new features to Ra开发者_开发问答ils. According to the Rails Guide on how to contribute to Rails, I should clone the main repository, create a branch, then make my changes in that branch.
My question is: after I've done all of that, how do I go about testing my changes in an actual Rails application? That is, how do I get a Rails application running on my machine to use the Rails code from my branch rather than the Rails code installed on my system?
The simplest approach I can think of is to simply replace the "rails" folder in my gems folder with the code from my branch, but it seems like there should be a cleaner way to do this.
If you're using bundler, just point to your modified version in your Gemfile by specifying either the path of the gem on the filesystem or your forked git repo. Like this:
gem 'rails', :path => '/full/path/to/mofidied/rails'
or for git:
gem 'rails', :git => git://github.com/github_user/your_rails.git
If you change the minor revision number and install it in your gems folder you can specify that new version when you create a new app
rails _3.0.x_ new newappname
精彩评论