Testing validity of URL

I am in early development of my first RoR project. I am following
Agile Web Development with Rails and am trying to adopt their best
practices ideas, specifically making use of the test suite and
Subversion.

I wish to validate a URL entered into a data entry field. I found
some code that does just that: http://www.igvita.com/blog/2006/09/07/validating-url-in-ruby-on-rails/
. I want to test it in my code.

It won't validate with WEbrick. I figured that Webrick just can't
reach out into the Internet, but I'm not sure of that. I think that
it might work if I were to use Apache. The instructions in the book
that deal with Apache are in a section on deployment. They suggest
deploying early and often. Sounds good to me. I thought I'd try to
deploy to another area of my Fedora 7 machine.

I've installed Mongrel and Capistrano. When I installed Mongrel, I
notice that it comes up on port 3000, just as WEbrick does.
Capistrano deploys to ports 8000 and 8001. Before the book talks
about connecting Apache and Mongrel, it calls for a test: curl -I
http://erie.lakeinfoworks.com:8000. I don't get a connection and I'm
not sure what to do about it.

As I see it, one of my options is to deploy to a real remote server.
I have one, but I'm not sure that it supports Ruby. Another is to
find a tutorial that will teach me how to use my local server as
though it were a remote.

Any suggestions? Thanks.

I wish to validate a URL entered into a data entry field. I found
some code that does just that: http://www.igvita.com/blog/2006/09/07/validating-url-in-ruby-on-rails/
. I want to test it in my code.

That code throws all kinds of errors when I tried it as shown.

It won't validate with WEbrick. I figured that Webrick just can't
reach out into the Internet, but I'm not sure of that.

The request to validates the URL is outbound, and has nothing to do
with what server you're running it on.

Try a simpler version, say just returning something like this:
    Net::HTTP.get_response(URI.parse('http://example.com')).code
and build out from there.

HTH!

<quote>Before the book (Agile Web Programming with Rails) talks about
connecting Apache and Mongrel, it calls for a test: curl -I
http://erie.lakeinfoworks.com:8000. I don't get a connection and I'm
not sure what to do about it. </quote>

I found that I needed to start mongrel with "mongrel_rails
cluster::start" instead of "mongrel_rails start -B". When I did this,
curl gives me the desired positive response. I've added the code to
the Apache configuration file as prescribed in my tutorial, including
the following code:
<Proxy balancer://mongrel_cluster>
   BalancerMember http://127.0.0.1:8000
   BalancerMember http://127.0.0.1:8001
</Proxy>
I got a "connection refused" error. I've been stumbling around
(because I really don't know what I'm doing) and chaged the 127.0.0.1
to 10.0.0.4 which is how my machine is defined in /etc/hosts. Now I
get a "Status: 500 Internal Server Error Content-Type: text/html"
error when I try to run my Rails program.

I realize at this point that I no longer have an RoR problem, but a
network configuration problem. However, I have this problem only
within the context of RoR and I suspect that others, if they haven't
had it, may get it. Hopefully, if I'm able to resolve it, others may
be helped, too.