02 Oct '13, 8pm

stumbled cross this - helpful - URL Validation in Rails

After doing a quick Google Search I realized that everyone might not know about a great way to do URL validation in Rails. The secret is a little-known method of the URI class, regexp . It lets you generate a regular expression for matching URLs based on an array of accepted protocols. What’s even better, it can be plugged directly into Rails’s validates_format_of . It’s this easy: class User validates_format_of :website, :with => URI::regexp(%w(http https)) end This will match anything that URI.parse will recognize, meaning that it’s a pretty accurate and powerful URL matcher. URL validation was one of those little annoyances in writing Rails models because it really seemed like there should be an easier way. I found mine, so I thought I’d share it!

Full article: http://www.intridea.com/blog/2009/2/18/quick-tip-url-vali...

Tweets

@clemensk yep, race conditions can happen becau...

api.rubyonrails.org 01 Oct '13, 2pm

Using this validation method in conjunction with ActiveRecord::Validations#save does not guarantee the absence of duplicat...

Using HTTP Status Codes for Rails AJAX Error Ha...

intridea.com 01 Oct '13, 4am

A problem that often arises in AJAX -based web applications is how to handle it when things go wrong. The user should be i...

New ebook: Geocoding on Rails, Your Map to Geoc...

robots.thoughtbot.com 03 Oct '13, 2pm

New ebook: Geocoding on Rails, Your Map to Geocoding Rails Applications jdclayton October 3, 2013 rails geocoding If you’v...

How to integrate AngularJS with Rails 4

rubyflow.com 01 Oct '13, 9pm

How to integrate AngularJS with Rails 4 Posted by Michal Kwiatkowski on October 01, 2013 — 0 comments Lots of practical ti...

didn't know this in #rails format phone numbers...

api.rubyonrails.org 15 Oct '13, 1pm

Provides methods for converting numbers into formatted strings. Methods are provided for phone numbers, currency, percenta...

#Ruby on #Rails: Deploy

rubyonrails.org 05 Oct '13, 12am

The easiest deployment setup for Rails is Phusion Passenger aka mod_rails. It's a module for nginx and Apache that automat...

How to use Ransack UI helpers with Mongoid on R...

rubyflow.com 30 Sep '13, 6pm

How to use Ransack UI helpers with Mongoid on Rails 4.0 Posted by mencio on September 30, 2013 — 0 comments I just posted ...

Fast tests in Ruby on Rails

rubyflow.com 01 Oct '13, 3pm

Fast tests in Ruby on Rails Posted by manualwise on October 01, 2013 — 0 comments Developers need to be able to run tests ...

6 Ways To Remove Pain From Feature Testing In R...

rubyflow.com 02 Oct '13, 5pm

6 Ways To Remove Pain From Feature Testing In Ruby On Rails Posted by joelturnbull on October 02, 2013 — 0 comments Writin...