<commit_before>class User < ActiveRecord::Base
  has_many :sites
  has_many :registrations

  validates :name, :presence => true

  class << self
    def find_or_create_from_omniauth(auth)
      find_from_omniauth(auth) || create_from_omniauth(auth)
    end

    def create_from_omniauth(auth)
      auth = auth.deep_symbolize_keys

      user = create! do |u|
        u.name = auth[:user_info][:name]
      end

      Registration.create! do |r|
        r.uid      = auth[:uid]
        r.provider = auth[:provider]
        r.user     = user
      end

      user
    end

    def find_from_omniauth(auth)
      auth = auth.deep_symbolize_keys

      registration = Registration.find_by_uid_and_provider(auth[:uid], auth[:provider])
      registration.try(:user)<commit_msg>Add some model dependencies<commit_after>class User < ActiveRecord::Base
  has_many :sites,         :dependent => :destroy
  has_many :registrations, :dependent => :destroy

  validates :name, :presence => true

  class << self
    def find_or_create_from_omniauth(auth)
      find_from_omniauth(auth) || create_from_omniauth(auth)
    end

    def create_from_omniauth(auth)
      auth = auth.deep_symbolize_keys

      user = create! do |u|
        u.name = auth[:user_info][:name]
      end

      Registration.create! do |r|
        r.uid      = auth[:uid]
        r.provider = auth[:provider]
        r.user     = user
      end

      user
    end

    def find_from_omniauth(auth)
      auth = auth.deep_symbolize_keys

      registration = Registration.find_by_uid_and_provider(auth[:uid], auth[:provider])
      registration.try(:user)
{'fraction_non_alphanumeric': 0.09765142150803462, 'fraction_numerical': 0.0, 'mean_word_length': 2.7651162790697676, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '7085279', 'n_tokens_mistral': 537, 'n_tokens_neox': 503, 'n_words': 104}