The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Ruby... how to setup and run.

Hello,
I've recently setup an apache server on my desktop with PHP, MySQL and PHPmyAdmin and it all works fine.

I also setup Ruby on Rails and it uses its own HTTP server, WEBrick.

1) How do i setup ruby to run as mod_ruby on apache? I've searched forums and google a bit but havn't found anything.

2) Using WEBrick, how do i access xxx.rb files? . If i go to 127.0.0.1:3000/xxx.rb it gives an error because i'm not using the proper Rails framework (or something). For example, with apache i just go to 127.0.0.1/phpfiles/xxx.php to run a script, how do i do the same w/ ruby?

3) Just a confirmation -- Ruby is more of a language than just for the internet? From my understanding, PHP is a web-based language but Ruby can do more than that? i'm not really clear on this. I looked through my c:/ruby directory and I'm trying to figure out how this all works...

OK, for development, you want to use Webrick, for production work, aviod apache, and use Lighttpd and fastcgi. Look into setting up the proxy modules if you have to run Apache as well as Lighttpd. For most cases, you can ditch Apache and use Lighttpd.

Basically, rails has two main modes, Development, and Production. You can change this in ./config/database.yml if my brain serves me right. Basically production mode uses some clever cache tricks to speed things up, and hides any complex errors in your apps so there is no security compromises. Development modes make give you more detaild error messages.

For general ruby development you don't need a webserver at all. Ruby is not like PHP, it's not tied to a specific task. However, if you are looking at GUI apps, you wanna look at some of the GUI libraries out there. Some will say Python is better for GUI apps as it compiles more, and is a tad faster, and it's fairly similar to Ruby on the surface.

Basically, rails has two main modes, Development, and Production. You can change this in ./config/database.yml if my brain serves me right. Basically production mode uses some clever cache tricks to speed things up, and hides any complex errors in your apps so there is no security compromises. Development modes make give you more detaild error messages.

Very close, I think you mixed up the database configurations for the different contexts testing, development and production with the actual place where you can set the environment for production/development.

If you're using lighttpd you'll want to set this in your lighttpd.conf for you application, or httpd.conf (or an include file if you're using a vhost setup).
Of course the quick way is to change the line in the file config/environment.rb which reads

Code:

RAILS_ENV = ENV['RAILS_ENV'] || 'development'

Change the 'development' bit to 'production'. However I don't recommend this as it can make deploying applications one step more involved, if you can, try to set the appropriate environment variable in your web server conf.