require not working on server

J

Jeff Pritchard

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)

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
 
K

Kyle Schmitt

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

RHEL4 is slightly...dated
Are you sure you've got the same versions of ruby on both platforms?
 
J

Jeff Pritchard

Kyle said:
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
 
J

Jeff Pritchard

Jeff Pritchard 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.
 
K

Kyle Schmitt

Jeff Pritchard 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,627
Members
45,328
Latest member
66Teonna9

Latest Threads

Top