# How to validate a patch submitted to rails core using .git

**URL:** <https://www.ruby-forum.com/t/how-to-validate-a-patch-submitted-to-rails-core-using-git/167686>\
**Category:** Rails\
**Created:** [May 11, 2009, 3:11pm UTC](https://www.ruby-forum.com/t/how-to-validate-a-patch-submitted-to-rails-core-using-git/167686 "2009-05-11T15:11:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [May 11, 2009, 3:11pm UTC](https://www.ruby-forum.com/t/how-to-validate-a-patch-submitted-to-rails-core-using-git/167686/1 "2009-05-11T15:11:39Z")

</div>

This is what I did.

I have Rails 2.3.2 installed.

rails demo  
ruby script/generate scaffold User name:string  
rake db:create  
rake db:migrate

> ruby script/console  
> Loading development environment (Rails 2.3.2)
> 
> > User.first  
> > User Load (0.3ms) SELECT \* FROM “users” LIMIT 1  
> > =\> nil
> 
> >

So far so good.

Now I will freeze rails.

> rake rails:freeze:gems  
> Try script/console again
> 
> > User.first  
> > User Load (0.3ms) SELECT \* FROM “users” LIMIT 1  
> > =\> nil

Now I will get rid of frozen rails.

> rake rails:unfreeze  
> (in /Users/nkumar/dev/scratch/demo)  
> rm -rf vendor/rails

Now I will install rails from github so that later I could apply the  
patch.

> git clone git://github.com/rails/rails.git

Now I will try script/console and I get error.  
Loading development environment (Rails 2.3.2)  
/Library/Ruby/Site/1.8/rubygems/requirement.rb:150:in  
`parse':ArgumentError: Illformed requirement ["~> 1.1.pre"] /Library/Ruby/Site/1.8/rubygems/requirement.rb:150:in`parse’:ArgumentError: Illformed requirement ["~\> 1.1.pre"]  
/Users/nkumar/dev/scratch/demo/vendor/rails/railties/lib/console\_with\_helpers.rb:5:NameError:  
uninitialized constant ApplicationController

> > User.first  
> > NameError: uninitialized constant User  
> > from (irb):1

Notice that I have not even applied the patch I want to test. I am just  
getting ready to apply the patch.

If I look at vendor/rails I see following directories.  
-rw-r–r-- 1 nkumar staff 3019 May 11 09:07 Rakefile  
drwxr-xr-x 9 nkumar staff 306 May 11 09:07 actionmailer  
drwxr-xr-x 10 nkumar staff 340 May 11 09:07 actionpack  
drwxr-xr-x 7 nkumar staff 238 May 11 09:07 activemodel  
drwxr-xr-x 11 nkumar staff 374 May 11 09:07 activerecord  
drwxr-xr-x 8 nkumar staff 272 May 11 09:07 activeresource  
drwxr-xr-x 10 nkumar staff 340 May 11 09:07 activesupport  
drwxr-xr-x 8 nkumar staff 272 May 11 09:07 ci  
drwxr-xr-x 3 nkumar staff 102 May 11 09:07 doc  
-rwxr-xr-x 1 nkumar staff 416 May 11 09:07 pushgems.rb  
drwxr-xr-x 18 nkumar staff 612 May 11 09:07 railties  
-rwxr-xr-x 1 nkumar staff 723 May 11 09:07 release.rb  
drwxr-xr-x 3 nkumar staff 102 May 11 09:07 tools

When I had done rake:rails:freeze then I had following directories.  
drwxr-xr-x 9 nkumar staff 306 May 11 09:09 actionmailer  
drwxr-xr-x 10 nkumar staff 340 May 11 09:09 actionpack  
drwxr-xr-x 10 nkumar staff 340 May 11 09:09 activerecord  
drwxr-xr-x 7 nkumar staff 238 May 11 09:09 activeresource  
drwxr-xr-x 5 nkumar staff 170 May 11 09:09 activesupport  
drwxr-xr-x 16 nkumar staff 544 May 11 09:09 railties

Can someone tell me what is the right way to test a patch.

I know Rails contribution guide has information on how to test a patch.  
However the document tells you to checkout rails from github and then  
apply a patch. I did. However how do I tell my demo app to use the newly  
patch applied rails version. The only way I know of is to do  
vendor/rails and ,as I illustrated above, that did not work for me.

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [May 11, 2009, 3:47pm UTC](https://www.ruby-forum.com/t/how-to-validate-a-patch-submitted-to-rails-core-using-git/167686/2 "2009-05-11T15:47:27Z")

</div>

On May 11, 2:11 pm, Raj S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Now I will try script/console and I get error.  
> Loading development environment (Rails 2.3.2)  
> /Library/Ruby/Site/1.8/rubygems/requirement.rb:150:in  
> `parse':ArgumentError: Illformed requirement ["~> 1.1.pre"] /Library/Ruby/Site/1.8/rubygems/requirement.rb:150:in `parse’:ArgumentError: Illformed requirement [“~\> 1.1.pre”]  
> /Users/nkumar/dev/scratch/demo/vendor/rails/railties/lib/console\_with\_helpe rs.rb:5:NameError:

IIRC with edge rails you need the latest version of rubygems (1.3.3  
currently).

Fred

---

<div class="post-metadata">

**Author:** ![dorelal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3da27b/32.png) [@dorelal](https://www.ruby-forum.com/u/dorelal)\
**Post date:** [May 11, 2009, 4:10pm UTC](https://www.ruby-forum.com/t/how-to-validate-a-patch-submitted-to-rails-core-using-git/167686/3 "2009-05-11T16:10:01Z")

</div>

Thanks Frederick. I upgraded ro rubygems 1.3.3 and things are working  
fine.

Thank you.
