request.env['HTTP_USER_AGENT']

Hi

I just want to do a simple output on my machine showing the ie browser.
Every example of request.env['HTTP_USER_AGENT'] that I have seen shows
no gem requirement. However, when I try to run this on my computer, I am
getting the error below. Do you know what I am doing wrong here? Thanks
MC

puts request.env['HTTP_USER_AGENT'].gsub(/\/| /, '')

Error:
browserVersion.rb:3: undefined local variable or method `request' for
main:Object (NameError)

···

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

The request object is usually something a web framework gives you. You
don't have a request for a regular ruby program.
You should run that piece of code inside the scope of a request
initiated by a browser to a URL served by your web server.

Jesus.

···

On Thu, May 6, 2010 at 9:17 PM, Mmcolli00 Mom <mmc_collins@yahoo.com> wrote:

Hi

I just want to do a simple output on my machine showing the ie browser.
Every example of request.env['HTTP_USER_AGENT'] that I have seen shows
no gem requirement. However, when I try to run this on my computer, I am
getting the error below. Do you know what I am doing wrong here? Thanks
MC

puts request.env['HTTP_USER_AGENT'].gsub(/\/| /, '')

Error:
browserVersion.rb:3: undefined local variable or method `request' for
main:Object (NameError)