schneidmaster/gitreports.com

View on GitHub
app/models/user.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
class User < ApplicationRecord
  has_and_belongs_to_many :repositories, -> { order 'name ASC' }, uniq: true
  has_and_belongs_to_many :organizations, -> { order 'name ASC' }, uniq: true

  def github_path
    "https://github.com/#{username}"
  end

  def avatar_url
    if self[:avatar_url].blank?
      "https://github.com/identicons/#{username}.png"
    else
      self[:avatar_url]
    end
  end
end