# Require not working on server

**URL:** <https://www.ruby-forum.com/t/require-not-working-on-server/146192>\
**Category:** Ruby\
**Created:** [August 18, 2008, 10:57pm UTC](https://www.ruby-forum.com/t/require-not-working-on-server/146192 "2008-08-18T22:57:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [August 18, 2008, 10:57pm UTC](https://www.ruby-forum.com/t/require-not-working-on-server/146192/1 "2008-08-18T22:57:09Z")

</div>

I’m developing on a Mac and deploying to a RHEL4 linux server. For some  
reason while “require” returns a boolean on the Mac, it is returning an  
empty array “[]” on the server. Where can I find the code for “require”  
and what makes it return an empty array instead of a boolean?

This seems to be only in the Rails app I’m working on. If I do this  
same sequence in IRB, it works as expected on both machines.

Thanks much for any ideas/assistance…

jp

On the mac:  
JP-iMac:synergy jeffpritchard$ script/console  
Loading development environment (Rails 2.1.0)

> > require ‘rubygems’  
> > =\> false
> 
> > require ‘redcloth’  
> > =\> true
> 
> > RedCloth.new(“fred”).to\_html  
> > =\> “
> > 
> > fred
> > 
> > ”
> 
> > quit

On the server:  
[foo@bar current]# script/console  
Loading development environment (Rails 2.1.0)

> > require ‘rubygems’  
> > =\> []
> 
> > require ‘redcloth’  
> > =\> []
> 
> > RedCloth.new(“fred”).to\_html  
> > NameError: uninitialized constant RedCloth::TextileDoc  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:275:in  
> > `load_missing_constant' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:467:in`const\_missing’  
> > from  
> > /usr/lib/ruby/gems/1.8/gems/RedCloth-4.0.2/lib/case\_sensitive\_require/…/redcloth.rb:17:in  
> > `new’  
> > from (irb):3
> 
> >

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [August 18, 2008, 11:52pm UTC](https://www.ruby-forum.com/t/require-not-working-on-server/146192/2 "2008-08-18T23:52:02Z")

</div>

On Mon, Aug 18, 2008 at 3:53 PM, Jeff P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> jp

RHEL4 is slightly…dated  
Are you sure you’ve got the same versions of ruby on both platforms?

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [August 19, 2008, 12:28am UTC](https://www.ruby-forum.com/t/require-not-working-on-server/146192/3 "2008-08-19T00:28:28Z")

</div>

Kyle S. wrote:

> On Mon, Aug 18, 2008 at 3:53 PM, Jeff P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > jp
> 
> RHEL4 is slightly…dated  
> Are you sure you’ve got the same versions of ruby on both platforms?

Yes, I have been updating ruby and rails as time went on. Both at 1.8.6  
for ruby. I know there is a 1.8.7, but some say it is not good with  
rails right now.

Also, I discovered that I had several older versions of ruby on the  
machine and have extirpated them all now. That didn’t fix it though.  
;(

thanks,  
jp

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [August 19, 2008, 12:48am UTC](https://www.ruby-forum.com/t/require-not-working-on-server/146192/4 "2008-08-19T00:48:27Z")

</div>

Jeff P. wrote:  
Even if you don’t have an idea to share, can somebody fill me in on how  
rubygems “works”?  
Does the “require ‘rubygems’” bring in some code that effectively  
replaces the ruby ‘require’?

I see a bunch of stuff in “boot.rb” in the rails app that relates to  
rubygems. Does this replace the ruby require mechanism as soon as the  
app starts up? I have the latest rubygems installed. It looks almost  
as though something must be going wrong with that.

> thanks,  
> jp

---

<div class="post-metadata">

**Author:** ![jeffpritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/43a26b/32.png) [@jeffpritchard](https://www.ruby-forum.com/u/jeffpritchard)\
**Post date:** [August 19, 2008, 3:14pm UTC](https://www.ruby-forum.com/t/require-not-working-on-server/146192/5 "2008-08-19T15:14:36Z")

</div>

On Mon, Aug 18, 2008 at 5:45 PM, Jeff P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Jeff P. wrote:  
> Even if you don’t have an idea to share, can somebody fill me in on how  
> rubygems “works”?  
> Does the “require ‘rubygems’” bring in some code that effectively  
> replaces the ruby ‘require’?

Well, more or less, I don’t know. But I know _some_ of it.  
When you go back to 1.8.5, you needed to  
require ‘rubygems’  
#before you required a gem  
require ‘camping’

I think (for ready-made gems) mostly what it does is add path  
information, but it also sets up logic to crawl the dependencies of a  
gem, so it can load the libraries the gem requires, IFF they happen to  
also be gems.

I’m pretty sure when 1.8.6 came out, however, you no longer needed to  
require rubygems. You could just:

require ‘camping’

–Kyle
