eRuby & Rails: Not Compatible

I’m new to Ruby, Rails, and this list. I’ve tried searching for an
answer but it all seems to be over my head. I have all the books but
again they seem to leave me on my own to figure out the stuff that
really matters. Where is the best place to find out the details?

Exactly what are these much celebrated “naming conventions”; i.e. where
do I find an exhaustive list of these rules?

Everything runs great under Webrick and then getting it all running
under Apache is a nightmare. Why is this?

Here’s the kind of output I’m getting in the logs:

[Sun Jun 04 19:13:10 2006] [error] mod_ruby: error in ruby
[Sun Jun 04 19:13:10 2006] [error] mod_ruby:
/srv/www/htdocs/bget.org/www/aistracking/app/views/client/list.rhtml:5:
uninitialized constant #Module:0x40ab0278::Client (NameError)
[Sun Jun 04 19:13:10 2006] [error] mod_ruby: from (eval):77
[Sun Jun 04 19:13:10 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:116:in eval_string_wrap' [Sun Jun 04 19:13:10 2006] [error] mod_ruby: from /usr/lib/ruby/1.8/apache/eruby-run.rb:116:in run’
[Sun Jun 04 19:13:10 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:72:in `handler’
[Sun Jun 04 19:13:10 2006] [error] mod_ruby: from
/usr/lib/ruby/1.8/auto-reload.rb:84

I’ve got all kinds of crazy stuff going on in my virtual host record.
Individual RBX and RHTML files can be made to work but Rails seems like
it always throws some kind of error. Here’s my virtual host record:

<VirtualHost 65.172.243.112:80>
ServerAdmin [email protected]
DocumentRoot /srv/www/htdocs/bget.org/www
ServerName www.bget.org
ServerAlias bget.org *.bget.org
ErrorLog /var/log/apache2/error_log
CustomLog /var/log/apache2/access_log common

DirectoryIndex index.html index.htm index.php index.cfm

UseCanonicalName Off
HostnameLookups Off
ServerSignature On
<Directory /srv/www/htdocs/bget.org/www>
Options FollowSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all

If the ruby module is installed, this will be enabled.

# for Apache::RubyRun RubyRequire apache/ruby-run

exec files under /ruby as ruby scripts.

<Location /srv/www/htdocs/bget.org/www>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
Options +ExecCGI

exec *.rbx as ruby scripts.

<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

exec *.rb as ruby scripts.

<Files *.rb>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

# for Apache::ERubyRun

RubyRequire apache/eruby-run

# handle files under /eruby as eRuby files by eruby.

<Location /srv/www/htdocs/bget.org/www>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

# handle *.rhtml as eruby files.

<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

# for Apache::ERbRun

RubyRequire apache/erb-run

# handle files under /erb as eRuby files by ERb.

<Location /erb>

SetHandler ruby-object

RubyHandler Apache::ERbRun.instance

# for debug

RubyRequire auto-reload

My thought is some patient soul will help me. Thanks in advance.

On 5-jun-2006, at 1:25, Day Davis Waterbury wrote:

Everything runs great under Webrick and then getting it all running
under Apache is a nightmare. Why is this?

Here’s the kind of output I’m getting in the logs:

I’m somewhat dusty on mod_ruby, and AFAIK I filed a bug for it’s
dispatcher quite a while ago (when 37signals abandoned mod_ruby in
favor of FCGI the dispatchr didn’t get any love apparently), but the
dispatcher made by the mod_ruby author, Shugo M., seemed to work
for me. Have you tried it?

http://blog.shugo.net/


Julian ‘Julik’ Tarkhanov
please send all personal mail to
me at julik.nl

I have the version distributed in the download for ruby 1.8.4
(2005-12-24) [i686-linux]…I think…er, but truth be known I’m a
little fuzzy on where all this stuff came from, I had to download the
main ruby package and then something (a package maner of some sort?)
called gems and then had to download specific stuff it seems for rails
and other specific stuff for eruby…so I forget which package had
mod_ruby in it at this point. I’d be happy to try anything that might
work; I’ll look into acquiring a different dispatcher if you think that
may be my problem…I’d be happy to use FCGI if I had any idea where to
start, but my only testing laboratory is a production server…so it’s a
bit sketchy messing around with the innards of Apache…but if I had a
clear way forward I might undertake it. Funny thing is that what I see
time and again is just, well “You’ll have to fiddle with it.” instead of
“This, this, this and this need to be done to make it work.” Perhaps
I’ve just been looking in the wrong places. Ok, I know the list isn’t
really the place for aimless gripes. I like Ruby. I’m going to try to
stick it out. Thanks for your help. Anyone else have any wisdom for me?

Julian ‘Julik’ Tarkhanov wrote:

Exactly what are these much celebrated “naming conventions”; i.e.
dispatcher made by the mod_ruby author, Shugo M., seemed to work


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Day Davis Waterbury
Lead Developer
Azimuth Internet Services, Ltd.
Toll Free 888.675.5261
http://www.azimuthinternet.com

http://www.azimuthinternet.com

On 5-jun-2006, at 5:01, Day Davis Waterbury wrote:

laboratory is a production server…so it’s a bit sketchy messing
around with the innards of Apache…but if I had a clear way
forward I might undertake it. Funny thing is that what I see time
and again is just, well “You’ll have to fiddle with it.” instead of
“This, this, this and this need to be done to make it work.”
Perhaps I’ve just been looking in the wrong places. Ok, I know the
list isn’t really the place for aimless gripes. I like Ruby. I’m
going to try to stick it out. Thanks for your help. Anyone else
have any wisdom for me?

If you want to just get it to run -follow the numerous instructions
and just run your Rails app on Mongrel below Apache. Seems the
simplest way for me.

http://fluxura.com/
http://brainspl.at/articles/2006/04/26/dead-simple-deployment

sudo gem install mongrel

cd /sites/my-rails-app
mongrel_rails start

and confiugure the proxying in Apache to forward everything to
Mongrel. Will spare you quite some time. You can start many Mongrels
and balance between them on the Apache side.

You will need the latest-and-greates Apache for it though. Or run it
via mod_fcgi, or via mod_fcgid (requires Apache 2 as well). Or run
lighttpd under apache and Rails as FCGI under lighttpd.


Julian ‘Julik’ Tarkhanov
please send all personal mail to
me at julik.nl

Thanks a lot Julian,

I haven’t had a chance to try Mongrel yet, but when I do I’ll be sure to
let you and the list know whether I meet with success. I have
Apache/2.0.54 which I see is not the latest and greatest (2.2.2)…but I
wonder if it’ll do. This sentence “Or run it via mod_fcgi, or via
mod_fcgid (requires Apache 2 as well). Or run lighttpd under apache and
Rails as FCGI under lighttpd.” is basically Greek to me…I just don’t
know enough about the details to able to make sense of it. When people
say “Open this file, find this line, and edit it to say _____,” that
works for me, otherwise I’m frequently at a loss. Sorry to be such a
newbie.

Thanks again,

Day

Julian ‘Julik’ Tarkhanov wrote:

might work; I’ll look into acquiring a different dispatcher if you

mongrel_rails start


Julian ‘Julik’ Tarkhanov
please send all personal mail to
me at julik.nl


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Day Davis Waterbury
Lead Developer
Azimuth Internet Services, Ltd.
Toll Free 888.675.5261
http://www.azimuthinternet.com

http://www.azimuthinternet.com