# Is there a best practice for when an app requires a gem?

**URL:** <https://www.ruby-forum.com/t/is-there-a-best-practice-for-when-an-app-requires-a-gem/136352>\
**Category:** Rails\
**Created:** [May 1, 2008, 4:17am UTC](https://www.ruby-forum.com/t/is-there-a-best-practice-for-when-an-app-requires-a-gem/136352 "2008-05-01T04:17:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [May 1, 2008, 4:17am UTC](https://www.ruby-forum.com/t/is-there-a-best-practice-for-when-an-app-requires-a-gem/136352/1 "2008-05-01T04:17:45Z")

</div>

Hi there,

Is there a standard/recommended way for a Rails app to express a  
dependency on a gem? For non-rails projects, we could package as a gem  
and hence use the gem spec to express dependencies.

I suppose I could do it by hand in environment.rb, but it seems like  
there ought to be a cleaner way. Am I missing something?

Thanks,

Brian H.

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [May 1, 2008, 4:27am UTC](https://www.ruby-forum.com/t/is-there-a-best-practice-for-when-an-app-requires-a-gem/136352/2 "2008-05-01T04:27:50Z")

</div>

Brian H. wrote:

> Is there a standard/recommended way for a Rails app to express a  
> dependency on a gem?

Try this: The program emits “no such file to load – foo”

The user responds with: sudo gem install foo

Problem solved. Just don’t go crazy and call your primary include file  
‘luxury\_yacht’, while your gem is called ‘throat\_warbler\_mangrove’. Name  
them  
the same so the error message

The rule “same thing same name” is a very important tenant of lean and  
clean  
programming.

–  
Phlip

---

<div class="post-metadata">

**Author:** ![kuma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/a587f6/32.png) [@kuma](https://www.ruby-forum.com/u/kuma)\
**Post date:** [May 1, 2008, 4:34am UTC](https://www.ruby-forum.com/t/is-there-a-best-practice-for-when-an-app-requires-a-gem/136352/3 "2008-05-01T04:34:17Z")

</div>

On 1 May 2008, at 03:17, Brian H. wrote:

> Hi there,
> 
> Is there a standard/recommended way for a Rails app to express a  
> dependency on a gem? For non-rails projects, we could package as a  
> gem  
> and hence use the gem spec to express dependencies.
> 
> I suppose I could do it by hand in environment.rb, but it seems like  
> there ought to be a cleaner way. Am I missing something?

[http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies](http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies)

Fred
