small medium large xlarge

25 Apr 2008, 13:15
Martin Hawkins (5 posts)

v2, p85: validates_format_of :image_url, :with => %r{.(gif|jpg|png)$}i, :message => “must be a URL for a GIF, JPG, or PNG image”

What does the “i” do at the end of the second line? I’ve tried it without and it seems to run fine.

25 Apr 2008, 13:19
Sam Ruby (633 posts)

It makes the regular expression case insensitive. With the i specified, the regular expression will match gif, GIF, Gif, gIf, etc.

You must be logged in to comment