# How to apply a patch to core rails using git?

**URL:** <https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730>\
**Category:** Rails\
**Created:** [January 2, 2009, 5:48am UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730 "2009-01-02T05:48:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [January 2, 2009, 5:48am UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730/1 "2009-01-02T05:48:35Z")

</div>

There is a patch for using the :selected option with collection\_select  
here -  
[#1037 :selected option is ignored for collection\_select - Ruby on Rails - rails](http://rails.lighthouseapp.com/projects/8994/tickets/1037-selected-option-is-ignored-for-collection_select).

Can someone tell me how to apply it? I have git 1.6.0.1 on leopard.

---

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [January 2, 2009, 11:13am UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730/2 "2009-01-02T11:13:10Z")

</div>

On 2 Jan 2009, at 04:47, Ram wrote:

> There is a patch for using the :selected option with collection\_select  
> here - [#1037 :selected option is ignored for collection\_select - Ruby on Rails - rails](http://rails.lighthouseapp.com/projects/8994/tickets/1037-selected-option-is-ignored-for-collection_select)  
> .
> 
> Can someone tell me how to apply it? I have git 1.6.0.1 on leopard.

Checkout rails from github and switch the relevant branch  
Download the patch file  
cd to where you have checked rails  
git am path/to/file

Fred

---

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [January 3, 2009, 11:07am UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730/3 "2009-01-03T11:07:10Z")

</div>

i have rails already in my mac… i cant find the folder though. it  
came with the OS X Leopard.

On Jan 2, 3:11 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [January 3, 2009, 12:07pm UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730/4 "2009-01-03T12:07:27Z")

</div>

On 3 Jan 2009, at 10:06, Ram wrote:

> i have rails already in my mac… i cant find the folder though. it  
> came with the OS X Leopard.

You’ll need to get it from git. There’s also no guarantee that it will  
apply on anything but edge.

Fred

---

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [January 5, 2009, 10:32am UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730/5 "2009-01-05T10:32:19Z")

</div>

On Jan 5, 4:21 am, Ram [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> oh ok… so what about the version in my mac? will that get overridden?  
> will my existing apps know which Rails to use? I will have to change  
> the version number in the environment config file if im using edge  
> right?

First off, you may not want to use edge. You can get basically any  
version of rails from git. It might be sensible to stick to the 2.2  
stable branch if you were previously on 2.2 (or 2.1 stable if you were  
on 2.1 etc…). If you’ve never upgraded rails you may have a slightly  
rocky road as the version that came with leopard was 1.2 which is a  
fair few version numbers behind.

The way I tend to do things is to freeze rails into the app: the app  
has its private copy of rails in vendor/rails which you can patch/  
modify as much as you want without affecting other apps. If you git  
clone rails into vendor rails your app will start using that version,  
no matter what environment.rb says

You could also just edit the rails that came with your machine (gem  
which foo tells you where the gem called foo is installed if my memory  
is correct) but that doesn’t sound very nice. I’d certainly recommend  
freezing rails into your app before you do anything (whether it’s  
freezing the version you’re currently using or edge rails).

Fred

---

<div class="post-metadata">

**Author:** ![ram](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@ram](https://www.ruby-forum.com/u/ram)\
**Post date:** [January 5, 2009, 5:22am UTC](https://www.ruby-forum.com/t/how-to-apply-a-patch-to-core-rails-using-git/156730/6 "2009-01-05T05:22:22Z")

</div>

oh ok… so what about the version in my mac? will that get overridden?  
will my existing apps know which Rails to use? I will have to change  
the version number in the environment config file if im using edge  
right?

On Jan 3, 4:06 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
