Re: Internal server error in apache2
Shugo Maeda <[email protected]>
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
Hi, At Tue, 22 Jun 2004 18:26:12 +0000, [email protected] wrote: > The exaple can be found here > > http://www.rubydoc.org/books/modruby/modruby.html#AEN200 > > And this is from my error_log > > [Wed Jun 23 00:31:34 2004] [error] mod_ruby: error in ruby > > /web/root/test.rhtml:3: undefined method `param' for #<CGI:0x41ae0dbc> > (NoMethodError) > from (eval):0 > from /usr/lib/ruby/1.8/apache/eruby-run.rb:114:in `eval_string_wrap' > from /usr/lib/ruby/1.8/apache/eruby-run.rb:114:in `run' > from /usr/lib/ruby/1.8/apache/eruby-run.rb:72:in `handler' I think this example should be fixed like this: <% require 'cgi' # Require the CGI library cgi = CGI.new() # New CGI object username = cgi.params['username'][0] %><html><head><title>eRuby Test</title></head> <body> <h1>Testing eRuby</h1> <% if username.nil? # Print out the form asking for the username %> <form method="post"> Please enter your username: <input type="text" name="username"><br> <input type="submit" value="Go"> </form> <% else %> Welcome <%= username %>! <% end %> </body> </html> Shugo