Displaying 1 result from an estimated 1 matches for "allowed_to_validate".
2005 May 04
1
Conditional validations
...http://dev.rubyonrails.com/ticket/1196) and have come up with a
tentative solution that I''d like to bring up here.
What if we use a "conditional" parameter in the validates_* methods?
Here''s how it would look like in practice:
class Movie < ActiveRecord::Base
def allowed_to_validate=(true_false)
@allowed_to_validate = true_false
end
def allowed_to_validate
@allowed_to_validate
end
protected
validates_length_of :title, :within => 1..30, :if => :allowed_to_validate
end
This would solve the problem that Joe discovered (one-way encrypted
attributes can...