(noob) Help with variables

I'm trying to make what amounts to a cloud files manager using the ruby
API. In the end I want login via MySQL and all that fun stuff, but for
now I want it to just -work-. I'm using eruby loaded via CGI on apache.

So I was able to list the containers on my account:

<% require 'rubygems'
require 'cloudfiles'
cf = CloudFiles::Connection::new('ryuujinx','APIKEYREMOVED') %>

<html>
        <head>
                <title>Cloud Files Manager</title>
        </head>
<body bgcolor="#000000">
<font color="#33FF00">

<center>
<h1>List of Containers:</h1>
<%
cf::list_containers::each do |listcont|
        puts listcont + "<br>"
end
%>

I could make it do it in a select menu with a form, etc, but my problem
is even if I do post it to a new page, I have no idea how to grab the
variables or anything.

The next step I would want to do is container =
cf::container('SELECTEDCONTAINER') for further manipulation such as the
ability to manage objects inside the container, but I'm kind of lost.

···

--
Posted via http://www.ruby-forum.com/.

I'm trying to make what amounts to a cloud files manager using the ruby
API. In the end I want login via MySQL and all that fun stuff, but for
now I want it to just -work-. I'm using eruby loaded via CGI on apache.

So I was able to list the containers on my account:

<% require 'rubygems'
require 'cloudfiles'
cf = CloudFiles::Connection::new('ryuujinx','APIKEYREMOVED') %>

<html>
<head>
<title>Cloud Files Manager</title>
</head>
<body bgcolor="#000000">
<font color="#33FF00">

<center>
<h1>List of Containers:</h1>
<%
cf::list_containers::each do |listcont|
puts listcont + "<br>"
end
%>

I believe you rather want

<% cf::list_containers::each do |listcont| %>
<%= listcont %><br>
<% end %>

I could make it do it in a select menu with a form, etc, but my problem
is even if I do post it to a new page, I have no idea how to grab the
variables or anything.

Not sure what you mean by "grab variables". If you need to evaluate
HTML form variables you can use
http://www.ruby-doc.org/core/classes/CGI.html

The next step I would want to do is container =
cf::container('SELECTEDCONTAINER') for further manipulation such as the
ability to manage objects inside the container, but I'm kind of lost.

Kind regards

robert

···

2010/3/11 James Dewey <admin@ryuujinx.com>:

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Robert Klemme wrote:

Not sure what you mean by "grab variables". If you need to evaluate
HTML form variables you can use
http://www.ruby-doc.org/core/classes/CGI.html

Kind regards

robert

Basically I want to be able to get variables from posting forms.

In PHP I would want to do something along the lines of

<form action="somepage.php" method="post">
<input type="text" name="somevar">
<input type="submit">
</form>

then on somepage.php use

The var on the last page was<?php echo $_POST["somevar"]; ?>

Only using ruby; in the article you linked I see CGI::Query that could
probably work if I use the GET method for the form instead of the POST
method; is there a way to use POST like shown with the php example?

···

--
Posted via http://www.ruby-forum.com/\.

Google for "ruby cgi post" reveals this as first hit:

<quote>Note: Ruby will take care of GET and POST methods
automatically. There is no separate treament for these two different
methods.</quote>

Cheers

robert

···

2010/3/11 James Dewey <admin@ryuujinx.com>:

Robert Klemme wrote:

Not sure what you mean by "grab variables". If you need to evaluate
HTML form variables you can use
http://www.ruby-doc.org/core/classes/CGI.html

Kind regards

robert

Basically I want to be able to get variables from posting forms.

In PHP I would want to do something along the lines of

<form action="somepage.php" method="post">
<input type="text" name="somevar">
<input type="submit">
</form>

then on somepage.php use

The var on the last page was<?php echo $_POST["somevar"]; ?>

Only using ruby; in the article you linked I see CGI::Query that could
probably work if I use the GET method for the form instead of the POST
method; is there a way to use POST like shown with the php example?

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/