<commit_before># encoding : utf-8
class User < ActiveRecord::Base
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  attr_accessible :username, :password, :password_confirmation, :name, :sex, :birthday, :status, :height, :position, :address, :relation, :image, :rights, :score, :description, :email
  STATUS    = %w(single married divorce).freeze
  RELATION  = %w(primary junior senior colleage society workmate relative)
  has_many  :user_loves,      dependent:  :destroy, inverse_of: :user,  class_name: UserLove
  has_many  :blogs,           dependent:  :destroy, inverse_of: :user
  has_many  :comments,        dependent:  :destroy, inverse_of: :user
  has_many  :link_categories, dependent:  :destroy, inverse_of: :user
  has_many  :messages

  # 加入has_secure_password后不再需要此代码
  # attr_accessor :password,  :password_confirmation

  before_save { self.email = email.downcase }

  # validates :username,    presence: true, uniqueness: true
  # username is quit

  validates :sex,         presence: { message: '请选择性别' }, :if => :profile?<commit_msg>fix a bug<commit_after># encoding : utf-8
class User < ActiveRecord::Base
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
  attr_accessible :username, :password, :password_confirmation, :name, :sex, :birthday, :status, :height, :position, :address, :relation, :image, :rights, :score, :description, :email, :status_name
  STATUS    = %w(single married divorce).freeze
  RELATION  = %w(primary junior senior colleage society workmate relative)
  has_many  :user_loves,      dependent:  :destroy, inverse_of: :user,  class_name: UserLove
  has_many  :blogs,           dependent:  :destroy, inverse_of: :user
  has_many  :comments,        dependent:  :destroy, inverse_of: :user
  has_many  :link_categories, dependent:  :destroy, inverse_of: :user
  has_many  :messages

  # 加入has_secure_password后不再需要此代码
  # attr_accessor :password,  :password_confirmation

  before_save { self.email = email.downcase }

  # validates :username,    presence: true, uniqueness: true
  # username is quit

  validates :sex,         presence: { message: '请选择性别' }, :if => :profile?
{'fraction_non_alphanumeric': 0.13120899718837864, 'fraction_numerical': 0.0009372071227741331, 'mean_word_length': 4.182038834951456, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5678140', 'n_tokens_mistral': 744, 'n_tokens_neox': 723, 'n_words': 178}