Displaying 1 result from an estimated 1 matches for "is_state_act".
2006 Feb 09
0
Validations with conditions (:if)
...I''m doing wrong?
Here is the code:
Using a symbol:
validates_length_of :name, :in => 3..30, :if = :active
Using proc:
validates_length_of :name, :in => 3..30, :if = Proc.new { |user|
user.active == true }
Using a method:
validates_length_of :name, :in => 3..30, :if = is_state_active
self.def is_state_active
Proc.new { |user| user.active == true }
end
I''m using Rails 1.0.
Thanks for your help.
--
Posted via http://www.ruby-forum.com/.