You must require 'open-uri' to be able to open URLS. For example:

>> open("http://example.com/";).read
Errno::ENOENT: No such file or directory - http://example.com/
        from (irb):2:in `initialize'
        from (irb):2:in `open'
        from (irb):2


But if you require 'open-uri':

>> require 'open-uri'
=> true
>> open("http://example.com/";).read
=> "<HTML>\r\n<HEAD>\r\n  <TITLE>Example Web Page</TITLE>\r\n</HEAD> \r
\n<body>  \r\n<p>You have reached this web page by
typing&quot;example.com&quot;,\r\n&quot;example.net&quot;,\r\n  or
&quot;example.org&quot; into your web browser.</p>\r\n<p>These domain
names are reserved for use in documentation and are not available \r
\n  for registration. See <a href="http://www.rfc-editor.org/rfc/
rfc2606.txt">RFC \r\n  2606</a>, Section 3.</p>\r\n</BODY>\r\n</HTML>\r
\n\r\n"


On Sep 30, 2:07 pm, Eric Gruber <[email protected]> wrote:
> What happened was I got the "We're sorry, but something went wrong."
> page from my
> app.
>
> I would prefer it all to be on one server, but the company I'm trying
> to do this for has many different projects, using different languages
> on two different servers. I'd rather not include a copy on the second
> server, so if I have to make a change to that one file (remember kids,
> don't repeat yourself!) I have to only do it once on one server.
>
> On Sep 30, 11:56 am, Marnen Laibow-Koser <rails-mailing-l...@andreas-
>
> s.net> wrote:
> > Eric Gruber wrote:
> > > If there's some sort of risk, please inform.
>
> > I agree, this is a terrible idea from both performance and architectural
> > perspectives.  Why do you want your navbar to live on another server?
>
> > > Not that it matters, that didn't work either.
>
> > What happened when you tried the open().read solution?  Just saying that
> > it didn't work isn't that helpful.
>
> > Best,
> > --
> > Marnen Laibow-Koserhttp://www.marnen.org
> > [email protected]
>
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to