def validate_phone(attribute, **options)
      options.reverse_merge!(phone_format: :india)
      if options[:phone_format] == :us
        reg_exp = /\A[0-9]{3}[-][0-9]{3}[-][0-9]{4}\z/
        length = 12
      else
        reg_exp = /\A[0-9]{10}\z/
        length = 10
      end
      options.merge!(format: reg_exp, min_length: length, max_length: length)
      options.reverse_merge!(numericality: true, mandatory: true, uniqueness: true)
      voptions = generate_validation_options(attribute, options)
      validates attribute, **voptions
    end
def validate_phone(attribute, **options)
      options.reverse_merge!(phone_format: :india)
      if options[:phone_format] == :us
        reg_exp = /\A[0-9]{3}[-][0-9]{3}[-][0-9]{4}\z/
        length = 12
      else
        reg_exp = /\A[0-9]{10}\z/
        length = 10
      end
      options.merge!(format: reg_exp, min_length: length, max_length: length)
      options.reverse_merge!(numericality: true, mandatory: true, uniqueness: true)
      voptions = generate_validation_options(attribute, options)
      validates attribute, **voptions
    end
format can be either :us or :indian