Ubuntu & Rails, can't get it to work

Hey list

While migrating our servers to brand new spanking Ubuntu machines, I
installed everything, but can’t get Rails to work.
I have the feeling it has to do with Apache2 itself, so hereby my
apache config file for this vhost.

<VirtualHost *>
ServerName djtrx.com
DocumentRoot /var/www/djtrx/public/
ErrorLog /var/log/apache2/djtrx-error.log
LogLevel warn

 CustomLog /var/log/apache2/djtrx.log combined

 <Directory /var/www/djtrx/public/>
   Options ExecCGI FollowSymLinks
   AddHandler cgi-script .fcgi
   AllowOverride all
   Order allow,deny
   Allow from all
 </Directory>

When I browse to the ip-address of the server, all I get is a
directory-listing of my /var/www dir. This is obviously not right,
but for now I’m stuck, can’t find what I’m looking for.

Any ideas?
thanks a bunch,
nemo

On 21-feb-2007, at 9:53, Bart Z. wrote:

Hey list

While migrating our servers to brand new spanking Ubuntu machines, I
installed everything, but can’t get Rails to work.

After further investigating, I came up with some more weirdness. When
I run dispatch.fcgi from the command-line, I get the following error
in my production.log:

undefined method downcase' for nil:NilClass /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/ request.rb:18:inmethod’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
base.rb:933:in log_processing' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/ base.rb:407:inprocess_without_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
filters.rb:377:in process_without_session_management_support' /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/ session_management.rb:117:inprocess’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in
dispatch' /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:150:inprocess_request’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:54:in
process!' /usr/lib/ruby/1.8/fcgi.rb:594:ineach_cgi’
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:53:in
process!' /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:inprocess!’
public/dispatch.fcgi:24

Some more info:
uname -a
Linux goserve-20061124 2.6.15-23-server #1 SMP Tue May 23 15:10:35
UTC 2006 i686 GNU/Linux
ruby -v
ruby 1.8.4 (2005-12-24) [i486-linux]
rails -v
Rails 1.2.2

But now I’m even more stuck…

/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in
Rails 1.2.2

But now I’m even more stuck…

I’m guessing Ubuntu Dapper Drake.
I’d recompile the latest version of ruby 1.8.5 and install it. Don’t
use the apt-get version, uninstall if you are.

My blog has some hints on this: I am going to update it for Edgy Eft,
eventually.


Ed Howland

On 2/21/07, Ed Howland [email protected] wrote:

I’m guessing Ubuntu Dapper Drake.
I’d recompile the latest version of ruby 1.8.5 and install it. Don’t
use the apt-get version, uninstall if you are.

Correct, I’m using Dapper Drake.
I manually/apt-get remove all RoR related fluff, and recompiled ruby
from
source, renewed my rubygems installation, etc etc.

When I create a testapp, and run ruby public/dispatch.fcgi, the
following
error occures:

You have a nil object when you didn’t expect it!
The error occured while evaluating nil.downcase^M
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/request.rb:18:in
method'^M /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:933:in log_processing’^M
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/base.rb:407:in
process_without_filters'^M /usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/filters.rb:377:in process_without_session_management_support’^M
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/session_management.rb:117:in
process'^M /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in dispatch’^M
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:150:in
process_request'^M /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:54:in process!‘^M
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.7/lib/fcgi.rb:606:in each_cgi'^M /usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:53:in process!’^M
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:23:in
`process!'^M
public/dispatch.fcgi:24

ruby -v gives:
ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-linux]
rails -v gives:
Rails 1.1.6

I am slowly going insane, please help me out here :slight_smile:

On 2/22/07, Bart Z. [email protected] wrote:

source, renewed my rubygems installation, etc etc.
log_processing'^M process_request’^M
ruby -v gives:
ruby 1.8.5 (2006-12-04 patchlevel 2) [i686-linux]
rails -v gives:
Rails 1.1.6

I am am getting the nil.downcase error as well, although on Rails 1.2.
Although when mine occurs it isn’t starting from Apache/FCGI. Have you
tried the app with Mongrel or Webbrick?

It seems others have seen this on Apache too, but no answers on this
list.
http://lists.rubyonrails.org/pipermail/rails/2006-August/060466.html
http://www.sovin.ca/sovin/articles/show/10
Make rake freeze_gems?

Ed


Ed Howland

Try this “manual” for installing Rails on Ubuntu.

http://wiki.slicehost.com/doku.php?id=install_ruby_on_rails

Francesc

On Feb 22, 2007, at 11:23 AM, Bart Z. wrote:

ruby from source, renewed my rubygems installation, etc etc.
/usr/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/
/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/fcgi_handler.rb:54:in
rails -v gives:
Rails 1.1.6

I am slowly going insane, please help me out here :slight_smile:

Cesc


name. francesc.esplugas
jabber. [email protected]
email. [email protected]
voice. 34 678 681 603

Hi,

I’m planning to have my site up and running publicly (virtual server at
BlueHost).

So far I’ve been developing on windows using Instant Rails. But now I’ll
have to use Apache and Linux (no Mongrel on BlueHost :-P) so I need to
practice to avoid spending days to setup the public one.

I’m using now Ubuntu 7.10 (on WMware Player). And I think I get the same
problems as you guys. Has anyone found a solution?

Here’s my symptoms:

When creating a test application and running it with WEbrick I get the
next error:

You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.to_sym

The problematic lines are:

<%= link_to ‘Edit’, edit_coches_path(coches) %>
<%= link_to ‘Destroy’, coches, :confirm => ‘Are you sure?’, :method =>
:delete %>
<%= link_to ‘New coches’, new_coches_path %>

When those are substituted with:

<%= link_to ‘Edit’, :controller=>“coches”, :action=>“edit”, :id=>coches
%>
<%= link_to ‘Destroy’, :confirm => ‘Are you sure?’,
:controller=>“coches”, :action=>“destroy”, :id=>coches %>
<%=link_to ‘New coches’, {:controller=>“coches”, :action=>“new”} %>

Then it seems to be working ok.

The routes.rb:

ActionController::Routing::Routes.draw do |map|
map.resources :coches
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end

Thanks!

[net note: don’t put “Re:” on a Subject. Only a reply should have one.]

comopasta Gr wrote:

I’m using now Ubuntu 7.10 (on WMware Player).

Good! The more Ubuntu in your life, the better. And write unit tests for
all
your code. They help everything, including portability. You should have
a batch
of tests that pass in both Windows and Ubuntu.

But beyond that, I don’t have an answer; just augmentations to your
questions!

And I think I get the same
The problematic lines are:

<%= link_to ‘Edit’, edit_coches_path(coches) %>
<%= link_to ‘Destroy’, coches, :confirm => ‘Are you sure?’, :method =>
:delete %>
<%= link_to ‘New coches’, new_coches_path %>

When those are substituted with:

<%= link_to ‘Edit’, :controller=>“coches”, :action=>“edit”, :id=>coches

shouldn’t that be coches.id?

map.resources :coches
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’
end

Is :id a magic thing that enforces an [:xdigit:] character class? Should

  • or
    shouldn’t - that :id be like :filename?


Phlip

<%= link_to ‘Edit’, :controller=>“coches”, :action=>“edit”, :id=>coches

shouldn’t that be coches.id?

Hi, thanks for the comments. Well I didn’t play that much with it.

The bottom line is that the original line created by scaffold:

<%= link_to ‘Edit’, edit_coches_path(coches) %>
causes errors when you try to fetch the index page

but

<%= link_to ‘Edit’, :controller=>“coches”, :action=>“edit”, :id=>coches
%>
goes through ok and displays all the entries in the db for coches

So the problem is that the first line uses edit_coches_path(coches) and
the second uses :controller and :action directly.

The original one is how Rails 2.0 is generating everything so I don’t
want to use the old way. There must be a fix somehow.

Cheers!

Ar Chron wrote:

Any compelling reason why you can’t run Feisty or Gutsy? I ask only
because that’s where my experience with Ubuntu and Rails begins…
either with a 7.10 server at work that is running in a VM, or on my own
7.04 desktop version running in VMware at home…

ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
Rails 2.0.2

and I haven’t had any real issues like those of which you speak, and
most of my server setup is straight “sudo apt-get install blah blah”

Unfortunately, what I know about Apache will fit in a thimble, so I
won’t be much help there.

I actually have Ubuntu server on its onw but I’m running something else
there and I wouldn’t like to screw it up because my knwoledge about
Apache is low.
And actually on that server I didnt have any problems after the
installation was done.

I guess I should give it another try and start from scratch.

Thanks.

I’m not sure if my first message got posted or not.
I’ve run into this issue before with FastCGI. The problem for me was
that the at the top of dispatch.rb, dispatch.fcgi and dispatch.cgi was
the path to a Ruby installation specific to a Windows machine, because
that’s where I was trying it out. However, the path is obviously very
different for Linux. Once I changed that path to point to where Ruby
was installed on that specific machine (in my case, /usr/bin/ruby),
the problem resolved itself.

So, make sure that your Rails app’s above files point to where Ruby is
installed. Also, it wouldn’t hurt if you had Ruby, RubyGems and Rails
versions and environments set in your shell’s path.

Hope this helps

On Mar 14, 1:51 pm, comopasta Gr [email protected]

Any compelling reason why you can’t run Feisty or Gutsy? I ask only
because that’s where my experience with Ubuntu and Rails begins…
either with a 7.10 server at work that is running in a VM, or on my own
7.04 desktop version running in VMware at home…

ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
Rails 2.0.2

and I haven’t had any real issues like those of which you speak, and
most of my server setup is straight “sudo apt-get install blah blah”

Unfortunately, what I know about Apache will fit in a thimble, so I
won’t be much help there.