I am trying to open a page when I go through an action. So in my controller I have the following:
class Controller < ApplicationController
require 'open-uri'
def action
open("http://www.google.com") #if i use this, it just goes to my action page
open("www.google.com") #if i use this, it gives the error
end
end
the error:
Errno::ENOENT in Controller#action
No such file or directory - www.google.com
All the solutions I have found just said to include require 'open-uri', which I believe I did. What am I doing wrong here?
EDIT:
Sorry I should have been more clear. I may have to open multiple pages in new tabs, which is why I decided to go with open instead of redirect_to. For example:
class Controller < ApplicationController
require 'open-uri'
def action
open("http://www.google.com")
open("http://www.yahoo.com")
end
end
where doing that would open both google.com and yahoo.com.