Problems with Ruby on Rails and Mechanize gem?

Hi all.

I’m doing a web site using “WWW::Mechanize”.

From my application, when I’m using the web site, I have a link, and
when I make click on the Iink, I want to log with my google mail, this
already works but now, I want to show the home page after logged.

This is my source:

require ‘rubygems’
require ‘mechanize’

def loggin
user = ‘[email protected]
pass = ‘abc123’

agent = WWW::Mechanize.new
page = agent.get

https://www.google.com/accounts/ServiceLogin?service=mail&passive=true&rm=false&continue=http%3A%2F%2Fmail.google.com%2Fmail%2F%3Fui%3Dhtml%26zy%3Dl&bsv=1eic6yu9oa4y3&scc=1&ltmpl=default&ltmplcache=2

form = page.forms.first
form.login = user
form.passwd = pass

page = agent.submit form

I tried this, but it didn’t work

redirect_to 'https://mail.google.com/mail/?shva=1#'

end