Displaying 1 result from an estimated 1 matches for "validates_as_phone_number".
2009 Sep 21
0
Polymorphic form
...This is saved as the value on a hidden field.
class Contact
  belongs_to :person
  acts_as_list :scope => :person
  validates_presence_of  :type
  validates_inclusion_of :type, :in => TYPES.map {|disp, val| val}
  validates_presence_of  :label
end
class PhoneNumber < Contact
#
# ...
#
  validates_as_phone_number :value
  validates_presence_of :value
  validates_uniqueness_of :value, :scope => [:person_id, :type]
end
class Address < Contact
  validates_presence_of :zip_addon_id
  validates_uniqueness_of :value, :scope => [:person_id, :type]
  belongs_to :zip_addon
end
Here''s one of the p...