RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Rails URL validation gem

Following the email validation gem, we made a small URL validation gem also. The difference is that this works with both Rails 2 and Rails 3. It’s pretty naive in its implementation, but it generally does the trick.

You can see the source at GitHub or grab the gem itself from RubyGems.

Comments

This is really useful something I implemented today with a regexp actually however, is waiting for an exception to be raised and catching it the best option?

Well i have not actually benchmarked it, but throwing an exception vs. applying a regexp should not be an issue performance wise.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in