<commit_before>class Account < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable
  attr_accessible :name, :password, :uid, :provider

  def self.new_with_session(params, session)
    super.tap do |account|
      if data = session["devise.facebook_data"] && session["device.facebook_data"]["extra"]["raw_info"]
        account.email = data['email']
      end
    end
  end

  def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
    account = Account.where(:provider => auth.provider, :uid => auth.uid).first
    unless account
      # アカウント情報がない場合新規作成
      account = Account.create(
                           name:auth.extra.raw_info.name,
                           provider:auth.provider,
                           email:auth.info.email,
                           password:<PASSWORD>.friendly_token[0, 20]
      )
    end
    account
  end

  def self.find_for_twitter_oauth(auth, signed_in_resource=nil)
    account = Account.where(:provider => auth.provider, :uid => auth.uid).first
    unless account
      account = Account.create(
                           name:auth.exra.raw_info.name,
                           provider:auth.provider,
                           uid:auth.uid,
                           #Twitterではemailは取得できない(Twitter側の仕様)
#                           email:auth.extra.user_hash.email,
                           password:<PASSWORD>.friendly_token[0, 20]
      )
    end
    account
  end
end<commit_msg>:bugs: 参照エラーを修正<commit_after>class Account < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,
         :omniauthable

  def self.new_with_session(params, session)
    super.tap do |account|
      if data = session["devise.facebook_data"] && session["device.facebook_data"]["extra"]["raw_info"]
        account.email = data['email']
      end
    end
  end

  def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
    account = Account.where(:provider => auth.provider, :uid => auth.uid).first
    unless account
      # アカウント情報がない場合新規作成
      account = Account.create(
                           name:auth.extra.raw_info.name,
                           provider:auth.provider,
                           email:auth.info.email,
                           password:<PASSWORD>.friendly_token[0, 20]
      )
    end
    account
  end

  def self.find_for_twitter_oauth(auth, signed_in_resource=nil)
    account = Account.where(:provider => auth.provider, :uid => auth.uid).first
    unless account
      account = Account.create(
                           name:auth.exra.raw_info.name,
                           provider:auth.provider,
                           uid:auth.uid,
                           #Twitterではemailは取得できない(Twitter側の仕様)
#                           email:auth.extra.user_hash.email,
                           password:<PASSWORD>]
      )
    end
    account
  end

  private
  def account_params
    params.require(:account).permit(:name, :password, :uid, :provider)
  end
end
{'fraction_non_alphanumeric': 0.09731343283582089, 'fraction_numerical': 0.0026865671641791043, 'mean_word_length': 2.102777777777778, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '7181248', 'n_tokens_mistral': 1003, 'n_tokens_neox': 970, 'n_words': 175}