Displaying 1 result from an estimated 1 matches for "actiberecord".
Did you mean:
acitverecord
2011 Jan 08
4
Help How to create DSL for conditional validations
...ss_validation attribute and I will bypass this validation.
I tried to create
def valid_with_cond(name, &block)
attr_accessor name
define_method "svalidator_#{name}" do |*arg|
if send name
yield *arg
end
end
end
But after trying it in
Class Person < ActibeRecord::Base
valid_with_cond :test do
if self.addresses > 3
errors[:base] << "Can not have more than 3 addresses".
end
end
end
But when I check it on console
Person.test
it throw me error test is private method.
Anybody could let me know how to correct it.
--
R...