Forum: Ruby on Rails validates_format error

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Rob B. (Guest)
on 2006-05-31 18:43
How does validate work? Is the file uploaded before the format is
checked?  I tried uploading a pdf and it crashed the WEBrick.  Out
putting this over and over:

**** Warning: Fonts with Subtype = /TrueType should be embedded.
But BookmanOldStyle is not embedded.

Surely the file should have been rejected before it is even uploaded?


class Image < ActiveRecord::Base
belongs_to :user

validates_presence_of :title, :file

validates_format_of :file, :with => %r{(gif|jpg|png)$}i, :message =>
"File must   end with .jpg, .gif or .png"

file_column :file, :magick => {
:versions => { "thumb" => "100x100", "medium" => "640x480>" }

This topic is locked and can not be replied to.