Sha256: 76875e6be3f96e02a17246cd0ec60e49799c220b2e2bbe1eded8be06b4282408

Contents?: true

Size: 451 Bytes

Versions: 5

Compression:

Stored size: 451 Bytes

Contents

class PhoneAccessCard < ApplicationRecord
  belongs_to :user_card

  # after_destroy :check_active

  before_validation :phone_normalize

  validates :value, presence: true, uniqueness: true, :allow_blank => false
  validates :value, :length => {:minimum => 10, :message => 'шорты'}

  def check_active
    self.user_card.set_active_card
  end

  def phone_normalize
    self.value = self.value.to_s.phone_cutter unless self.value.nil?
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
digital_heroes_startkit-0.1.1.4 app/models/phone_access_card.rb
digital_heroes_startkit-0.1.1.3 app/models/phone_access_card.rb
digital_heroes_startkit-0.1.1.2 app/models/phone_access_card.rb
digital_heroes_startkit-0.1.1.1 app/models/phone_access_card.rb
digital_heroes_startkit-0.1.1 app/models/phone_access_card.rb