<commit_before># == Schema Information
#
# Table name: terms
#
#  id         :integer          not null, primary key
#  name       :string
#  created_at :datetime         not null
#  updated_at :datetime         not null
#
class Term < ActiveRecord::Base
  has_many :definitions, dependent: :destroy

  accepts_nested_attributes_for :definitions

  validates :name,  presence: true,
                    length: {
                      minimum: 2, too_short: "requires at least %{count} characters",
                      maximum: 50, too_long: "is limited to %{count} characters."
                    }

  validates_associated :definitions

  before_save :capitalize_name

  default_scope { order('name ASC') }

  def capitalize_name
    if not self.name[0].match /[[:upper:]]/
      self.name = self.name.capitalize
    end
  end

end
<commit_msg>changes capitalize to titleize before_save<commit_after># == Schema Information
#
# Table name: terms
#
#  id         :integer          not null, primary key
#  name       :string
#  created_at :datetime         not null
#  updated_at :datetime         not null
#
class Term < ActiveRecord::Base
  has_many :definitions, dependent: :destroy

  accepts_nested_attributes_for :definitions

  validates :name,  presence: true,
                    length: {
                      minimum: 2, too_short: "requires at least %{count} characters",
                      maximum: 50, too_long: "is limited to %{count} characters."
                    }

  validates_associated :definitions

  before_save :titleize_name

  default_scope { order('name ASC') }

  def titleize_name
    if self.name[1].match /[[:lower:]]/
      self.name = self.name.titleize
    end
  end

end

{'fraction_non_alphanumeric': 0.08979591836734693, 'fraction_numerical': 0.004664723032069971, 'mean_word_length': 2.3, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6155687', 'n_tokens_mistral': 516, 'n_tokens_neox': 481, 'n_words': 143}