# Understanding Rails Internals (i.e. files generated by the r

**URL:** <https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775>\
**Category:** Rails\
**Created:** [November 13, 2005, 7:54pm UTC](https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775 "2005-11-13T19:54:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![virgild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@virgild](https://www.ruby-forum.com/u/virgild)\
**Post date:** [November 13, 2005, 7:54pm UTC](https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775/1 "2005-11-13T19:54:11Z")

</div>

Hi. I’m trying to understand the files generated by the ‘rails’ command.  
I  
get the controller/model/view files, but get confused about what the  
environment, boot, and dispatch files do.

Also, which of these files are dependent on the OS as I develop in  
WinXP/MySQL for win/webrick and the production server will be a  
Linux/Apache  
box.

Thanks.  
Vurg  
(From [ASP.NET](http://ASP.NET) to RoR)

---

<div class="post-metadata">

**Author:** ![virgild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@virgild](https://www.ruby-forum.com/u/virgild)\
**Post date:** [November 14, 2005, 5:45am UTC](https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775/2 "2005-11-14T05:45:12Z")

</div>

Hey Vurg. I’m also as [ASP.NET](http://ASP.NET) → Rails guys. First off, I’d recommend  
getting subversion and checking out the Rails source. It’s always  
clearer when you can go right to the code and see what’s going on…at  
least for Rails internals.

boot.rb just sets up things up (calls the initializer.rb see source,  
sets up the environment, etc.) You most likely won’t have to mess with  
this one.

environment.rb is what sets the setting for your app. Here is where  
you configure the enviroment (if not using server environment  
variables), load paths, and any custom settings. Think of it as  
similar to the web.config, but it’s code rather than XML.

The dispatch.\* files are what runs your rails app.

dispatch.rb - used for webrick (pure ruby dev web server)  
dispatch.cgi - used for CGI with Apache/LightTPD  
dispatch.fcgi - used for FastCGI with Apache/LightTPD

The shebang (first line with the #!) will be specific to the  
environment. It is the path to the Ruby exe. For example:

In windows - #!c:\ruby\bin\ruby  
In \*nix - #!/user/local/bin/ruby

Everything else (with the potential exception of the Win/Linux end of  
line issue) should work in both environments.

Hope that helps. And to all the rails gurus – please correct me if  
I’m wrong. This is just off the top of my head.

–Ryan

---

<div class="post-metadata">

**Author:** ![virgild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@virgild](https://www.ruby-forum.com/u/virgild)\
**Post date:** [November 14, 2005, 3:22pm UTC](https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775/3 "2005-11-14T15:22:59Z")

</div>

Thanks Ryan, that seems like the right direction. I’ll go check the  
source.

“Ryan W.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in  
message  
news:removed\_email\_address@domain.invalid…  
Hey Vurg. I’m also as [ASP.NET](http://ASP.NET) → Rails guys. First off, I’d recommend  
getting subversion and checking out the Rails source. It’s always  
clearer when you can go right to the code and see what’s going on…at  
least for Rails internals.

boot.rb just sets up things up (calls the initializer.rb see source,  
sets up the environment, etc.) You most likely won’t have to mess with  
this one.

environment.rb is what sets the setting for your app. Here is where  
you configure the enviroment (if not using server environment  
variables), load paths, and any custom settings. Think of it as  
similar to the web.config, but it’s code rather than XML.

The dispatch.\* files are what runs your rails app.

dispatch.rb - used for webrick (pure ruby dev web server)  
dispatch.cgi - used for CGI with Apache/LightTPD  
dispatch.fcgi - used for FastCGI with Apache/LightTPD

The shebang (first line with the #!) will be specific to the  
environment. It is the path to the Ruby exe. For example:

In windows - #!c:\ruby\bin\ruby  
In \*nix - #!/user/local/bin/ruby

Everything else (with the potential exception of the Win/Linux end of  
line issue) should work in both environments.

Hope that helps. And to all the rails gurus – please correct me if  
I’m wrong. This is just off the top of my head.

–Ryan

---

<div class="post-metadata">

**Author:** ![virgild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@virgild](https://www.ruby-forum.com/u/virgild)\
**Post date:** [November 14, 2005, 3:50pm UTC](https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775/4 "2005-11-14T15:50:04Z")

</div>

You can also find the rails source code that RubyGems installed on your  
system by looking at:

…/ruby/lib/ruby/gems/1.8/gems/…

(hopefully I got that right… did it from memory)

Curt

---

<div class="post-metadata">

**Author:** ![virgild](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/77aa72/32.png) [@virgild](https://www.ruby-forum.com/u/virgild)\
**Post date:** [November 14, 2005, 5:08pm UTC](https://www.ruby-forum.com/t/understanding-rails-internals-i-e-files-generated-by-the-r/47775/5 "2005-11-14T17:08:16Z")

</div>

Yup, they’re there. Thanks Curt.

## Vurg

“Curt H.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in  
message  
news:removed\_email\_address@domain.invalid…  
You can also find the rails source code that RubyGems installed on your  
system by looking at:

…/ruby/lib/ruby/gems/1.8/gems/…

(hopefully I got that right… did it from memory)

Curt

On 11/14/05, Vurg [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Thanks Ryan, that seems like the right direction. I’ll go check the  
source.

“Ryan W.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in  
message  
news:removed\_email\_address@domain.invalid  
…  
Hey Vurg. I’m also as [ASP.NET](http://ASP.NET) → Rails guys. First off, I’d recommend  
getting subversion and checking out the Rails source. It’s always  
clearer when you can go right to the code and see what’s going on…at  
least for Rails internals.

boot.rb just sets up things up (calls the initializer.rb see source,  
sets up the environment, etc.) You most likely won’t have to mess with  
this one.

environment.rb is what sets the setting for your app. Here is where  
you configure the enviroment (if not using server environment  
variables), load paths, and any custom settings. Think of it as  
similar to the web.config, but it’s code rather than XML.

The dispatch.\* files are what runs your rails app.

dispatch.rb - used for webrick (pure ruby dev web server)  
dispatch.cgi - used for CGI with Apache/LightTPD  
dispatch.fcgi - used for FastCGI with Apache/LightTPD

The shebang (first line with the #!) will be specific to the  
environment. It is the path to the Ruby exe. For example:

In windows - #!c:\ruby\bin\ruby  
In \*nix - #!/user/local/bin/ruby

Everything else (with the potential exception of the Win/Linux end of  
line issue) should work in both environments.

Hope that helps. And to all the rails gurus – please correct me if  
I’m wrong. This is just off the top of my head.

–Ryan

On 11/13/05, Vurg \<removed\_email\_address@domain.invalid \> wrote:

> Vurg  
> (From [ASP.NET](http://ASP.NET) to RoR)
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

* * *

Rails mailing list  
removed\_email\_address@domain.invalid  
[http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)
