# Rails gem precedence

**URL:** <https://www.ruby-forum.com/t/rails-gem-precedence/142780>\
**Category:** Rails\
**Created:** [July 11, 2008, 12:22pm UTC](https://www.ruby-forum.com/t/rails-gem-precedence/142780 "2008-07-11T12:22:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![msp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@msp](https://www.ruby-forum.com/u/msp)\
**Post date:** [July 11, 2008, 12:22pm UTC](https://www.ruby-forum.com/t/rails-gem-precedence/142780/1 "2008-07-11T12:22:25Z")

</div>

Hi folks

I am dev’ing a gem from a Github fork and I want to integration test  
my changes in my Rails project.

Previously I had been able to copy the gem into vendor/gems to ensure  
this took precedence over the locally installed gem.

I can’t see why this is no longer the case or how to investigate how  
Rails will resolve the gems - is there some kinda cache?

I guess my alternative is to build and install the gem locally from my  
edited fork but it seemed easier just to copy it to vendor/gems.

Thoughts/comments welcome.

Matt

portaputer:speechbox matt$ rake gems  
(in /Volumes/data/dev/speechbox)  
Type ‘svnversion --help’ for usage.  
[F] haml  
[] rcov  
[F] mislav-will\_paginate  
[I] msp-youtube-g

I = Installed  
F = Frozen  
portaputer:speechbox matt$ ll vendor/gems/  
total 0  
drwxr-xr-x 12 matt matt 408 Jun 24 11:55 mislav-  
will\_paginate-2.3.2/  
drwxr-xr-x 13 matt matt 442 Jun 27 15:33 haml-2.0.0/  
drwxr-xr-x 13 matt matt 442 Jul 11 10:42 msp-youtube-g/  
portaputer:speechbox matt$ cat config/environment.rb | grep config.gem  
config.gem “haml”  
config.gem “rcov”  
config.gem “mislav-will\_paginate”, :lib =\> “will\_paginate”, :source  
=\> “[http://gems.github.com/](http://gems.github.com/)”  
config.gem “msp-youtube-g”, :lib =\> “youtube\_g”, :source =\> “http://  
[gems.github.com/](http://gems.github.com/)”  
portaputer:speechbox matt$

---

<div class="post-metadata">

**Author:** ![msp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@msp](https://www.ruby-forum.com/u/msp)\
**Post date:** [July 12, 2008, 5:19pm UTC](https://www.ruby-forum.com/t/rails-gem-precedence/142780/2 "2008-07-12T17:19:00Z")

</div>

OK, to answer my own Q…

It seems that Rails has to “know” the Gem has been unpacked. I am not  
sure where it keeps this state but unless you have issued a `rake gems:unpack GEM=mygem' previously, and`rake gems’ shows mygem as  
frozen then the contents of vendor/gems/mygem will be ignored…

---

<div class="post-metadata">

**Author:** ![msp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ac8455/32.png) [@msp](https://www.ruby-forum.com/u/msp)\
**Post date:** [July 13, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/rails-gem-precedence/142780/3 "2008-07-13T19:36:02Z")

</div>

Your frozen gem isn’t being detect because the directory name is missing  
the version. Rails is trying to match a  
msp-youtube-g-\* directory that doesn’t exist.

Tiago M.
