<commit_before>class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable,
         :confirmable, :lockable, :validatable, :timeoutable

  after_create :create_club

  attr_accessible :name, :email, :password, :password_confirmation, :remember_me

  validates :name,  :presence => true, :uniqueness => true
  validates :email, :presence => true, :uniqueness => true

  has_many :clubs, :dependent => :destroy

  has_many :posts, :conditions => proc { "user_id = #{self.id}" }

  has_many :subscriptions, :class_name => ClubsUsers

  def memberships
    Club.find subscriptions.map(&:club_id)
  end

  private

  def create_club
    club = self.clubs.new
    club.assign_defaults
    club.save :validate => false
  end
end<commit_msg>Update User Model for description and icon<commit_after>class User < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable,
         :confirmable, :lockable, :validatable, :timeoutable

  after_create :create_club

  attr_accessible :name, :description, :email, :password, :password_confirmation, :remember_me

  has_many :clubs, :dependent => :destroy

  has_many :posts, :conditions => proc { "user_id = #{self.id}" }

  has_many :subscriptions, :class_name => ClubsUsers

  has_attached_file :icon, :styles      => { :medium => "256x256>", :thumb => "100x100>" },
                           :default_url => Settings.users[:default_icon]

  validates :name,        :presence => true, :uniqueness => true
  validates :email,       :presence => true, :uniqueness => true
  validates :description, :presence => { :message => "for user can't be blank" }

  validates_attachment_content_type :icon, :content_type => [ 'image/jpeg', 'image/gif', 'image/png', 'image/tiff' ]

  def memberships
    Club.find subscriptions.map(&:club_id)
  end

  def assign_defaults
    self.description = Settings.users[:default_description]
  end

  private

  def create_club
    club = self.clubs.new
    club.assign_defaults
    club.save :validate => false
  end
end
{'fraction_non_alphanumeric': 0.11834040546911834, 'fraction_numerical': 0.005657708628005658, 'mean_word_length': 4.004716981132075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '762391', 'n_tokens_mistral': 689, 'n_tokens_neox': 649, 'n_words': 162}