ruby on rails newbie please help cgi problem

Hi Just wondering I installed rails but cant seem to get any CGI scripts running i created a directory in the railsproject/public directory called cgi-bin which I gave Options +ExecCGI. Furthermore, I cant get any .rhtml files to parse embedded ruby. I find ruby on rails extremely complicated, this is my first experience with configuring apache and ruby on rails and I am getting very frustrated. I am running apache2 on ubuntu 7.10 I set up the virtual directory and am greeted with the riding on rails screen (however if i click about your applications environment i get an error). I am wondering if I should even be using rails as i programmed with ruby before using DBI modules for database connectivity and never had any problems. Mainly what I want to do is get embedded ruby working. I had this working before with eruby and the mod_ruby module but i switched to mod_rails and now everything has gone to crap. Any help is GREATLY appreciated, please bear in mind I am primarily a windows software programmer and am very new to ubuntu, apache and rails.

I placed this file in the available-sites directory called gridtest

<code> <VirtualHost 127.0.1.1:4268>     ServerName gridtest.com     ServerAlias www.gridtest.com     DocumentRoot /var/www/htdocs/railstest/public     <Directory "/var/www/htdocs/railstest/public/cgi-bin/">        AllowOverride None        Options +ExecCGI        Order allow,deny        Allow from all     </Directory>   </VirtualHost> </code>

Thanks,

Adam

Hi Just wondering I installed rails but cant seem to get any CGI scripts running i created a directory in the railsproject/public directory called cgi-bin which I gave Options +ExecCGI. Furthermore, I cant get any .rhtml files to parse embedded ruby. I find ruby on rails extremely complicated, this is my first experience with configuring apache and ruby on rails and I am getting very frustrated. I am running apache2 on ubuntu 7.10 I set up the virtual directory and am greeted with the riding on rails screen (however if i click about your applications environment i get an error)

That may be a partial red herring - the stuff to display the application environment is not loading in production mode (which is what mod_rails defaults to I believe. Dunno about the rest - I doubt many people writing rails apps use cgi scripts like that.

Fred

. I am wondering if I should even be using

complicated, this is my first experience with configuring apache and ruby on rails and I am getting very frustrated. I am running apache2 on

Maybe mod_rails will help, as it simplifies deployment. Cheers! -=R

Roger Pack wrote:

complicated, this is my first experience with configuring apache and ruby on rails and I am getting very frustrated. I am running apache2 on

Maybe mod_rails will help, as it simplifies deployment. Cheers! -=R

I have installed mod_rails but still cant seem to get the embedded ruby working in .rhtml files. Do I need eruby for this if so how do I configure it with mod rails? Following is the configuration I had with eruby and mod_ruby which was working before. It seems from what I have read that ruby comes with erb for embedding ruby in .rhtml and .erb.html files. I can revert back to these settings but I really want to understand what is going wrong here.

The following code was stored in /conf.d/ruby.conf

<code>   AddType text/html .rhtml

  <IfModule mod_ruby.c>     RubyRequire apache/ruby-run     RubyRequire apache/eruby-run

    # Execute *.rbx files as Ruby scripts     <Files *.rbx>       SetHandler ruby-object       RubyHandler Apache::RubyRun.instance     </Files>

    # Handle *.rhtml files as eRuby files     <Files *.rhtml>       ErrorDocument 500 /etc/apache2/customerror/error_500.rb       SetHandler ruby-object       RubyHandler Apache::ERubyRun.instance     </Files>   </IfModule> </code>

Why aren't you just letting rails render your templates?

Fred

Frederick Cheung wrote:

configure it with mod rails?

Why aren't you just letting rails render your templates?

Fred

Im sorry Im really knew to rails, what are these templates and how do I render them with rails.

I am also wondering is there any advantage to using rails if I write my own login script / use the DBI module for database connectivity? It seems from what I have heard that rails is primarily useful due to its easy of deployment. I want to become more familiar with rails because I keep hearing good things about it and it seems like it is quickly becoming very popular so I am just wondering what are the specific benefits?

Thanks,

Adam

Frederick Cheung wrote:

configure it with mod rails?

Why aren't you just letting rails render your templates?

Fred

Im sorry Im really knew to rails, what are these templates and how
do I render them with rails.

It sounds to me like you just want to dump some rhtml templates
somewhere and have ruby render them. That's fine, but that's
fundamentally not how rails work. Rails applications have a very specific structure. Your app splits
into models, typically wrappers round a database table, controllers
which sit between the outside world and your models, and views which
are the .rhtml (now usually named .html.erb) files you were worrying
about. Apache never touches a .rhtml file directly - it hands the
request over to a rails worker (a mongrel, a fastcgi instance, a
mod_rails instance) which does a bunch of stuff (which may include
rendering one of the app's rhtml templates) and passes the response back I could waffle about this more, but I think that you would have more
to gain by reading one of the many rails tutorials (make sure you pick
a fairly recent one). I'd also advise that you forget about apache for
a second. webrick/mongrel (which you can launch by running ruby script/server
from the root of our app) are more than enough to get you going.

I am also wondering is there any advantage to using rails if I write
my own login script / use the DBI module for database connectivity? It seems from what I have heard that rails is primarily useful due to its easy of deployment. I want to become more familiar with rails
because I keep hearing good things about it and it seems like it is quickly becoming very popular so I am just wondering what are the specific benefits?

While there are many great things about rails, I wouldn't call ease of
deployment its main strength (if anything historically it has been
what puts people off).

Fred