Forum: Ruby on Rails ruby on rails newbie please help cgi problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9397b7fcfdce4869a017107edf0e88c1?d=identicon&s=25 Adam Hurlburt (dark_helmut)
on 2008-10-13 21:35
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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-13 21:54
(Received via mailing list)
On Oct 13, 8:35 pm, Adam Hurlburt <rails-mailing-l...@andreas-s.net>
wrote:
> 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
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2008-10-14 22:43
> 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
9397b7fcfdce4869a017107edf0e88c1?d=identicon&s=25 Adam Hurlburt (dark_helmut)
on 2008-10-15 04:49
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>
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-15 09:56
(Received via mailing list)
On Oct 15, 3:49 am, Adam Hurlburt <rails-mailing-l...@andreas-s.net>
wrote:
> configure it with mod rails?
Why aren't you just letting rails render your templates?

Fred
9397b7fcfdce4869a017107edf0e88c1?d=identicon&s=25 Adam Hurlburt (dark_helmut)
on 2008-10-16 02:32
Frederick Cheung wrote:
> On Oct 15, 3:49�am, Adam Hurlburt <rails-mailing-l...@andreas-s.net>
> 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
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-10-16 02:50
(Received via mailing list)
On 16 Oct 2008, at 01:32, Adam Hurlburt wrote:

> 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.

>
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
This topic is locked and can not be replied to.