<commit_before># == Schema Information
#
# Table name: users
#
#  id                     :integer          not null, primary key
#  email                  :string           default(""), not null
#  encrypted_password     :string           default(""), not null
#  reset_password_token   :string
#  reset_password_sent_at :datetime
#  remember_created_at    :datetime
#  sign_in_count          :integer          default(0), not null
#  current_sign_in_at     :datetime
#  last_sign_in_at        :datetime
#  current_sign_in_ip     :inet
#  last_sign_in_ip        :inet
#  created_at             :datetime
#  updated_at             :datetime
#

class User < ActiveRecord::Base
  has_paper_trail

  devise :database_authenticatable,
         :rememberable, :trackable

  before_create :assigns_default_permission_roles

  has_one :person

  has_and_belongs_to_many :followed_projects,
                          class_name: Project.name,
                          join_table: :users_following_projects

  has_and_belongs_to_many :followed_technologies,
                          class_name: Technology.name,
                          join_table: :users_following_technologies

  has_and_belongs_to_many :followed_clients,
                          class_name: Client.name,
                          join_table: :users_following_clients

  has_and_belongs_to_many :followed_people,
                          class_name: Person.name,
                          join_table: :users_following_people

  has_and_belongs_to_many :liked_projects,
                          class_name: Project.name,
                          join_table: :users_liking_projects

  has_and_belongs_to_many :liked_technologies,
                          class_name: Technology.name,
                          join_table: :users_liking_technologies

  has_and_belongs_to_many :liked_clients,
                          class_name: Client.name,
                          join_table: :users_liking_clients

  has_and_belongs_to_many :liked_people,
                          class_name: Person.name,
                          join_table: :users_liking_people

  has_and_belongs_to_many :permission_roles,
                          class_name: Permission::Role.name,
                          join_table: :users_permission_roles,
                          association_foreign_key: 'permission_role_id'

  private

  def assigns_default_permission_roles
    Permission::Role.where(default: true).each do |permission_role|
      permission_roles << permission_role
    end
  end
end
<commit_msg>change user model to use concern for authentication based on environment configuration<commit_after># == Schema Information
#
# Table name: users
#
#  id                     :integer          not null, primary key
#  email                  :string           default(""), not null
#  encrypted_password     :string           default(""), not null
#  reset_password_token   :string
#  reset_password_sent_at :datetime
#  remember_created_at    :datetime
#  sign_in_count          :integer          default(0), not null
#  current_sign_in_at     :datetime
#  last_sign_in_at        :datetime
#  current_sign_in_ip     :inet
#  last_sign_in_ip        :inet
#  created_at             :datetime
#  updated_at             :datetime
#

class User < ActiveRecord::Base
  include ::Authenticatable

  has_paper_trail

  before_create :assigns_default_permission_roles

  has_one :person

  has_and_belongs_to_many :followed_projects,
                          class_name: Project.name,
                          join_table: :users_following_projects

  has_and_belongs_to_many :followed_technologies,
                          class_name: Technology.name,
                          join_table: :users_following_technologies

  has_and_belongs_to_many :followed_clients,
                          class_name: Client.name,
                          join_table: :users_following_clients

  has_and_belongs_to_many :followed_people,
                          class_name: Person.name,
                          join_table: :users_following_people

  has_and_belongs_to_many :liked_projects,
                          class_name: Project.name,
                          join_table: :users_liking_projects

  has_and_belongs_to_many :liked_technologies,
                          class_name: Technology.name,
                          join_table: :users_liking_technologies

  has_and_belongs_to_many :liked_clients,
                          class_name: Client.name,
                          join_table: :users_liking_clients

  has_and_belongs_to_many :liked_people,
                          class_name: Person.name,
                          join_table: :users_liking_people

  has_and_belongs_to_many :permission_roles,
                          class_name: Permission::Role.name,
                          join_table: :users_permission_roles,
                          association_foreign_key: 'permission_role_id'

  private

  def assigns_default_permission_roles
    Permission::Role.where(default: true).each do |permission_role|
      permission_roles << permission_role
    end
  end
end

{'fraction_non_alphanumeric': 0.05430128454651616, 'fraction_numerical': 0.00038925652004671076, 'mean_word_length': 1.9449856733524356, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3347685', 'n_tokens_mistral': 1466, 'n_tokens_neox': 1409, 'n_words': 259}