<commit_before>class User < ActiveRecord::Base
  # use simple_token_authentication on users
  acts_as_token_authenticatable

  # Allow login via username.
  attr_accessor :username

  validates_length_of :about_me, maximum: 500, allow_blank: true

  # A user has many projects, and deleting user deletes projects of that user
  has_many :enrollments
  has_many :courses, through: :enrollments
  has_many :projects, class_name: "Project", foreign_key: :owner

  # FIXME -- how do we handle projects with multiple owners?
  # def projects
  #   Project.where(owner: self.id).all
  # end

  def assignments
    self.courses.map(&:assignments).flatten
  end


  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable,
         :registerable,
         :recoverable,
         :rememberable,
         :trackable,
         :validatable

  has_attached_file :avatar,
  default_url: "default_avatar.jpg",
  storage: :s3,<commit_msg>Cleanup user model, fix a bug with username<commit_after>class User < ActiveRecord::Base
  # use simple_token_authentication on users
  acts_as_token_authenticatable

  validates_length_of :about_me, maximum: 500, allow_blank: true

  # A user has many projects, and deleting user deletes projects of that user
  has_many :enrollments
  has_many :courses, through: :enrollments
  has_many :projects, class_name: "Project", foreign_key: :owner

  def assignments
    self.courses.map(&:assignments).flatten
  end

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable,
         :registerable,
         :recoverable,
         :rememberable,
         :trackable,
         :validatable

  has_attached_file :avatar,
  default_url: "default_avatar.jpg",
  storage: :s3,
{'fraction_non_alphanumeric': 0.07814992025518341, 'fraction_numerical': 0.004253056884635832, 'mean_word_length': 3.965699208443272, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5129488', 'n_tokens_mistral': 595, 'n_tokens_neox': 562, 'n_words': 162}