Hey,

 I'm VERY new to Ruby on Rails. I was wondering if somebody could help
me out by clearing up a few things. I've been noticing that stuff I try
in Ruby will work fine, but the same code in a Rails app won't work. So
let me post a few lines of code here, and maybe (hopefully) somebody
can help me figure out why it works in a ruby shell thingy and not in a
rails app.

Here's the Ruby:

 require 'mechanize'

agent = WWW::Mechanize.new

agent.user_agent_alias = 'Windows IE 6'

page =
agent.get('https://login.yahoo.com/config/login?login=xxxxx&passwd=xxxxx&tries=1&.src=srch&.lg=us&partner=&submit=Sign+In&.done=http://submit.search.yahoo.com/free/request')

page =
agent.get('http://submit.search.yahoo.com/free/request?class=Submit&pass=1&url=http%3A//wherever.net')

p page


When this runs, it works just fine. When I try it in a rails app, as
posted below, it doesn't. I'll post the error message too.

class EnginesController < ApplicationController

require 'net/http'
require 'net/https'
require 'uri'
  require 'mechanize'

  def yahoo

  agent = WWW::Mechanize.new

agent.user_agent_alias = 'Windows IE 6'

page = agent.get('https://login.yahoo.com/config/login?
login=xxxxx&passwd=xxxxx&tries=1&.src=srch&.lg=us&partner=&submit=Sign+In&.done=http://submit.search.yahoo.com/free/request')

page =
agent.get('http://submit.search.yahoo.com/free/request?class=Submit&pass=1&url=http%3A//wherever.net')

  @data=page
  end
end

(@data is just a variable that gets send to the output page)
I then navigate to the correct page and I get this error:

undefined method `add_header' for #<Net::HTTP::Get GET>

I really don't understand. There are a few other errors that I get in
Rails that I don't understand either; a lot having to do with
databases. I'm pretty sure both my Ruby and Rails installations are
current. I greatly appreciate any help and advice you can give.

Thanks,
   Burak