# Problems with Ruby on Rails and Mechanize gem?

**URL:** <https://www.ruby-forum.com/t/problems-with-ruby-on-rails-and-mechanize-gem/189680>\
**Category:** Rails\
**Created:** [June 5, 2010, 12:39am UTC](https://www.ruby-forum.com/t/problems-with-ruby-on-rails-and-mechanize-gem/189680 "2010-06-05T00:39:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgegetafe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/eada6e/32.png) [@jorgegetafe](https://www.ruby-forum.com/u/jorgegetafe)\
**Post date:** [June 5, 2010, 12:39am UTC](https://www.ruby-forum.com/t/problems-with-ruby-on-rails-and-mechanize-gem/189680/1 "2010-06-05T00:39:53Z")

</div>

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 = ‘removed\_email\_address@domain.invalid’  
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](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
