In a model there is a field
validates :image_file_name, :format => { :with => %r{\\.(gif|jpg|jpeg|png)$}i
It looks pretty odd for me.
It mean that image_file_name must end ($) with dot and one of gif, jpg, jpeg or png.
image_file_name
$
Yes %r{} mean exactly the same as // but in %r{} you don't need to escape /.
%r{}
//
/