У меня есть JavaScript для маскировки значения в моей форме. Я пытаюсь удалить эту маску перед тем сохранить его в БД, но у меня есть проблемыудаление маски перед сохранением в DB
модель:
class Partner < ApplicationRecord
belongs_to :address, dependent: :destroy
has_many :dependents
accepts_nested_attributes_for :address
# Validations #
# Validates presence of some attributes #
validates_presence_of :registry_number, :name, :secretary, :position, :base_salary, :rg, :cpf, :birthday, :email, :union_admission, :start_date
validates :registry_number, numericality: {only_integer: true}
# Validates the size of some attributes #
validates :registry_number, length: {maximum: 5}
validates :cpf, length: {is: 11}
validates :rg, length: {is: 9}
validates :phone_number, length: {maximum: 11}
:cpf.gsub(/[.\/]/, '')
end
ошибка
undefined method `gsub' for :cpf:Symbol
Extracted source (around line #18):
16
17
18
19
20
:cpf.gsub(/[.\/]/, '')
end
Как я могу это решить?
Спасибо за помощь. Отличный ответ! – Kirk