| Module | ActiveRecord::Validations::ClassMethods |
| In: |
lib/adaptation/validateable.rb
|
Validates whether the value of the specified xml attribute/element has a valid email format.
Example:
<contact email="mail@xample.com">...</contact>
class Contact < Adaptation::Message
has_one :attribute, :email
validates_as_email :email
end
Validates whether the value of the specified xml attribute/element is the expected one.
Example 1:
<leftwing side="left"/>
class Leftwing < Adaptation::Message
has_one :attribute, :side
validates_value_of :side, "left"
end
Example 2:
<bird><wings><wing side="left"/><wing side="right"/></wings></bird>
class Bird < Adaptation::Message
has_many :wings
validates_value_of :side, "left", :in => :wings
end