search for: validates_format

Displaying 3 results from an estimated 3 matches for "validates_format".

2006 May 31
0
validates_format error
...tting 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? Model: 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>" } } end -- Posted via http://www.ruby...
2006 Apr 27
0
DRY validation
...ing validates_* constraints on a per-attribute basis. I just created a small plugin that allows you to do this. Here''s an example from one of my models: class Country < ActiveRecord::Base attribute :name, :string do |a| a.validates_length :within => 1..48 a.validates_format :with => /\A[A-Z](?:\s*[''\(-]?[A-Za-z]+[,\. \)]?)*\z/ a.validates_uniqueness end attribute :code_alpha2, :string do |a| a.validates_length :is => 2 a.validates_format :with => /\A[A-Z]+\z/ a.validates_uniqueness end attribute :cod...
2006 May 23
11
putting the schema in the model files
THE SCHEMA IN THE MODEL a small write up on ''putting the schema in the model'' This is a write up on an issue best covered in a mailing list thread of Januari 2006 (see the links in the text), I repost it because I think it deserves a place on the agenda. == Why? == I was switching back and forward between the model files and the schema.rb -- off course I have