class Event < ActiveRecord::Base attr_accessor :step_processing validates_presence_of :name,:description , :if => (:step_processing == 4) end class TestController < ApplicationController def bar @event = Event.new @event.step_processing = 4 @event.name = 'foo' @event.save end end In the above code :step_processing a non-database field. It's just there to control the processing. The validation should take place only when the step_processing is '4' but in reality it's done every single time. I guess I am goofing up the syntax or something like that. Thanks.
on 2006-01-14 22:34