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

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 to RoR)

Hey Vurg. I’m also as 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

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

“Ryan W.” [email protected] wrote in
message
news:[email protected]
Hey Vurg. I’m also as 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

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

Yup, they’re there. Thanks Curt.

Vurg

“Curt H.” [email protected] wrote in
message
news:[email protected]
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 [email protected] wrote:
Thanks Ryan, that seems like the right direction. I’ll go check the
source.

“Ryan W.” [email protected] wrote in
message
news:[email protected]

Hey Vurg. I’m also as 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 <[email protected] > wrote:

Vurg
(From ASP.NET to RoR)


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


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


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