Hi Nikos,
On Tue, Mar 18, 2008 at 8:26 PM, Nikos Dimitrakopoulos <[EMAIL PROTECTED]> wrote: > > the model: > class Item < ActiveRecord::Base > has_many :images, :dependent => :destroy > protected > def validate > errors.add(:images, "cannot be empty") if self.images.count > end > end self.images.count is always true, the Fixnum 0 (returned when theres no images) is true try on irb: foo = "bar" if [].size I guess the correct way is errors.add(:images, "cannot be empty") if self.images.size < 1 Regards, -- Rafael Mueller http://queroseragil.wordpress.com
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users