Sha256: 9192a0b5e909c498fda5ce4adbc058fe0ec104ed95638d7dfe9196eedf479c5c

Contents?: true

Size: 369 Bytes

Versions: 5

Compression:

Stored size: 369 Bytes

Contents

class NicknameAccessCard < ApplicationRecord

  belongs_to :user_card

  before_validation :normalize
  validates :value, presence: true, uniqueness: true, format: {with: /\A([a-zA-Z][\w]{0,14})\z/i}, :allow_blank => false

  def normalize
    self.value.downcase!
  end

  # after_destroy :check_active

  def check_active
    self.user_card.set_active_card
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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