# Trouble configuring Ruby on Rails



## njbignell (Sep 14, 2009)

I'm trying to get a Ruby on Rails application up and running but when I point my browser to http://localhost/public I get the following error from Phusion Passenger: 

Error message:

```
undefined method `map' for nil:NilClass
```

Exception Class:

```
NoMethodError
```

Here's the first two lines of the backtrace, let me know if you need anything else...


```
0 /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb 270 in `activate'
1 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 35 in `require'
```

Thanks for any help anyone can give.


----------



## njbignell (Sep 14, 2009)

Here'e the rest of the backtrace:


```
0	/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb	270	in `activate'
1	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	35	in `require'
2	/usr/local/www/apache22/data/solunas/vendor/rails/activesupport/lib/active_support/core_ext/module.rb	4	
3	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `gem_original_require'
4	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `require'
5	/usr/local/www/apache22/data/solunas/vendor/rails/activesupport/lib/active_support/core_ext.rb	3	
6	/usr/local/www/apache22/data/solunas/vendor/rails/activesupport/lib/active_support/core_ext.rb	1	in `each'
7	/usr/local/www/apache22/data/solunas/vendor/rails/activesupport/lib/active_support/core_ext.rb	1	
8	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `gem_original_require'
9	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `require'
10	/usr/local/www/apache22/data/solunas/vendor/rails/activesupport/lib/active_support.rb	55	
11	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `gem_original_require'
12	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `require'
13	/usr/local/www/apache22/data/solunas/vendor/rails/activerecord/lib/active_record.rb	25	
14	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `gem_original_require'
15	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `require'
16	/usr/local/www/apache22/data/solunas/vendor/rails/railties/lib/initializer.rb	266	in `require_frameworks'
17	/usr/local/www/apache22/data/solunas/vendor/rails/railties/lib/initializer.rb	266	in `each'
18	/usr/local/www/apache22/data/solunas/vendor/rails/railties/lib/initializer.rb	266	in `require_frameworks'
19	/usr/local/www/apache22/data/solunas/vendor/rails/railties/lib/initializer.rb	134	in `process'
20	/usr/local/www/apache22/data/solunas/vendor/rails/railties/lib/initializer.rb	113	in `send'
21	/usr/local/www/apache22/data/solunas/vendor/rails/railties/lib/initializer.rb	113	in `run'
22	/usr/local/www/apache22/data/solunas/config/environment.rb	9	
23	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `gem_original_require'
24	/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb	31	in `require'
25	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb	303	in `preload_application'
26	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb	252	in `initialize_server'
27	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/utils.rb	254	in `report_app_init_status'
28	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb	237	in `initialize_server'
29	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb	194	in `start_synchronously'
30	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb	163	in `start'
31	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/railz/application_spawner.rb	213	in `start'
32	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb	262	in `spawn_rails_application'
33	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb	126	in `lookup_or_add'
34	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb	256	in `spawn_rails_application'
35	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb	80	in `synchronize'
36	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server_collection.rb	79	in `synchronize'
37	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb	255	in `spawn_rails_application'
38	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb	154	in `spawn_application'
39	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/spawn_manager.rb	287	in `handle_spawn_application'
40	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb	352	in `__send__'
41	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb	352	in `main_loop'
42	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/lib/phusion_passenger/abstract_server.rb	196	in `start_synchronously'
43	/usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.5/bin/passenger-spawn-server	61
```


----------



## bb (Sep 14, 2009)

I've not used passanger. Does the app work on mongrel?


----------



## njbignell (Sep 14, 2009)

I can't figure out how to install mongrel either, I'm pretty new to all this stuff. 

Does anyone know where I can get a step-by-step guide to getting a ruby on rails application up and running on Apache? I might have botched the installation somehow as I did do a lot of playing around while trying to get this all happening


----------



## bb (Sep 14, 2009)

Is it an open source app, so that I could try it on my fbsd installation?


----------



## njbignell (Sep 14, 2009)

Yeah it is. Here's the link:
http://sourceforge.net/projects/solunas/

That would be great if you could. Many thanks


----------



## bb (Sep 15, 2009)

Ok. I installed the following ports:

* lang/ruby
* converters/ruby-iconv
* databases/ruby-mysql
* devel/ruby-gems

The I installed rails into my user account:

gem install rails

(but it can be installed from the ports as well)


I changed the database settings in config/database.yml: The socket path is wrong!

Setup the database with

rake db:create:all
rake db:schema:load

Startup the app:

ruby scripts/server


I can access the web application with the browser. I had to fiddle with the database and insert an admin user manually: First try to login, and in the log you will see the hashed_password, rails is trying to lookup. Then insert the data into the users table manually.


----------



## njbignell (Sep 15, 2009)

Ok, I set up a fresh install of FreeBSD, added apache and mysql then followed your instructions.

What changes do I have to make in database.yml? I've changed sqlite3 to mysql in the file but is there anything else?

When I run 
	
	



```
rake db:create:all
```
 I get an error:


```
rake aborted!
undefined method 'map' for nil:NilClass
```


----------

