GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

User.phone=()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 3
rs 10
1
class User < ActiveRecord::Base
2
  validates :name, :phone, :presence => true, :uniqueness => true
3
  validate :phone_plausible
4
5
  def phone_plausible
6
    errors.add(:phone, :invalid) if phone.present? && !Phony.plausible?(phone)
7
  end
8
9
  def phone=(value)
10
    Phony.plausible?(value) ? super(Phony.normalize(value)) : super(value)
11
  end
12
13
  after_create do
14
    ## This would send SMS instantly and slow app down...
15
    # UserTexter.welcome(self).deliver_now
16
17
    ## ...so let's use shiny, async ActiveJob instead
18
    UserTexter.welcome(self).deliver_later
19
  end
20
end
21