# Where to start

**URL:** <https://www.ruby-forum.com/t/where-to-start/71472>\
**Category:** Ruby\
**Created:** [October 9, 2006, 8:11am UTC](https://www.ruby-forum.com/t/where-to-start/71472 "2006-10-09T08:11:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pet\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@Pet\_F](https://www.ruby-forum.com/u/Pet_F)\
**Post date:** [October 9, 2006, 8:11am UTC](https://www.ruby-forum.com/t/where-to-start/71472/1 "2006-10-09T08:11:08Z")

</div>

Hi,

I found there are some Ruby programs are running in this development  
machines. Now I need to add some functionality into the Ruby program,  
but I don’t know where to look into its starting program or its main  
body of the program.

in aparche/httpd.conf file:

## 

## SSL Virtual Host Context

## 

FastCgiServer /www/apps/scripts/public/dispatch.fcgi -idle-timeout 90  
-initial-env RAILS\_ENV=production -processes 10

Here is the dispatch.fcgi script:  
require File.dirname( **FILE** ) + “/…/config/environment”  
require ‘fcgi\_handler’

RailsFCGIHandler.process!

I got stuck. I don’t know how does this dispatch.fcgi program invoke  
which ruby main program…

Can anyone please shed some light on me?

Thanks  
S

---

<div class="post-metadata">

**Author:** ![Pet\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@Pet\_F](https://www.ruby-forum.com/u/Pet_F)\
**Post date:** [October 9, 2006, 8:31am UTC](https://www.ruby-forum.com/t/where-to-start/71472/2 "2006-10-09T08:31:12Z")

</div>

Pet,

It seems you have a Ruby on Rails web app running on your machine. The  
dispatch.fcgi file is, as its name says, a dispatcher for your rails  
app and it’s handled by your apache’s mod\_fcgi.

Hope it helps.

Thiago

---

<div class="post-metadata">

**Author:** ![Pet\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@Pet\_F](https://www.ruby-forum.com/u/Pet_F)\
**Post date:** [October 9, 2006, 9:57am UTC](https://www.ruby-forum.com/t/where-to-start/71472/3 "2006-10-09T09:57:16Z")

</div>

Thiago J. wrote:

> Pet,
> 
> It seems you have a Ruby on Rails web app running on your machine. The  
> dispatch.fcgi file is, as its name says, a dispatcher for your rails  
> app and it’s handled by your apache’s mod\_fcgi.
> 
> Hope it helps.
> 
> Thiago

Hi in the same directory as the dispatch.cgi file, I also found a file  
dispatch.rb a ruby script file. But I don’t know how this both  
dispatch.cgi and dispatch.rb file are related.  
In the dispatch.cgi file, what command/ruby script does it dispatched?  
The dispatch.rb file has the following implementation:

# less dispatch.rb

#!/usr/local/bin/ruby18

require File.dirname( **FILE** ) + “/…/config/environment” unless  
defined?(RAILS\_ROOT)

# If you’re using RubyGems and mod\_ruby, this require should be changed

to an absolute path one, like:

# “/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher” –

otherwise performance is severely impaired  
require “dispatcher”

ADDITIONAL\_LOAD\_PATHS.reverse.each { |dir| $:.unshift(dir) if  
File.directory?(dir) } if defined?(Apache::RubyRun)  
Dispatcher.dispatch

Thanks  
S

---

<div class="post-metadata">

**Author:** ![Pet\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@Pet\_F](https://www.ruby-forum.com/u/Pet_F)\
**Post date:** [October 9, 2006, 1:03pm UTC](https://www.ruby-forum.com/t/where-to-start/71472/4 "2006-10-09T13:03:17Z")

</div>

On 10/9/06, Pet F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> Thanks
> 
> > > Can anyone please shed some light on me?

As was said before, you have a rails application. It’s not neccessary  
to dive into deep parts of the code. You’d rather read some tutorial  
on rails, so you know how to write models, controllers, views and  
helpers. That way you’ll faster see the forest, instead of individual  
trees 😉 When you’ll know this, you can find the appropriate stuff,  
judging by the url that you call.

small hints:

1. all the interesting stuff is in the app directory. urls are sent to  
controllers - /controller (=class)/action (=method)/all other  
parameters
2. most of the things you see are in views, the common parts are  
shared in laayouts
3. the data are in models
