<commit_before>class UserGroup < ActiveRecord::Base
  default_scope -> { order('created_at ASC') }
  has_paper_trail

  include Twitterable

  after_commit :send_tweet!

  mount_uploader :logo, UserGroupLogoUploader

  include PgSearch
  # https://github.com/Casecommons/pg_search
  pg_search_scope :search_for,
    against: %i[name description topics city state_province country ],
    using:   %i[tsearch trigram]

  extend FriendlyId
  friendly_id :slug_candidates, use: :slugged

  validates :city, presence: true
  validates :country, presence: true
  validates :description, presence: true, length: { minimum: 8, maximum: 2048 }, allow_blank: false
  validates :homepage, presence: true
  validates :name, presence: true, uniqueness: true, length: { minimum: 8, maximum: 64 }, allow_blank: false
  validates :state_province, presence: true

  belongs_to :registered_by, class_name: 'User', foreign_key: 'registered_by_id'

  def slug_candidates
    [
      :name,
      [:name, :city],
      [:name, :city, :state_province],
      [:name, :city, :state_province, :country]
    ]
  end

  geocoded_by :address
  after_validation :geocode

  def address
    [city, state_province, country].join(', ')
  end

  def send_tweet!
    UserGroupTweeterJob.new.async.later(15, id)
  end<commit_msg>Looks like the later stuff will have to wait until JRuby<commit_after>class UserGroup < ActiveRecord::Base
  default_scope -> { order('created_at ASC') }
  has_paper_trail

  include Twitterable

  after_commit :send_tweet!

  mount_uploader :logo, UserGroupLogoUploader

  include PgSearch
  # https://github.com/Casecommons/pg_search
  pg_search_scope :search_for,
    against: %i[name description topics city state_province country ],
    using:   %i[tsearch trigram]

  extend FriendlyId
  friendly_id :slug_candidates, use: :slugged

  validates :city, presence: true
  validates :country, presence: true
  validates :description, presence: true, length: { minimum: 8, maximum: 2048 }, allow_blank: false
  validates :homepage, presence: true
  validates :name, presence: true, uniqueness: true, length: { minimum: 8, maximum: 64 }, allow_blank: false
  validates :state_province, presence: true

  belongs_to :registered_by, class_name: 'User', foreign_key: 'registered_by_id'

  def slug_candidates
    [
      :name,
      [:name, :city],
      [:name, :city, :state_province],
      [:name, :city, :state_province, :country]
    ]
  end

  geocoded_by :address
  after_validation :geocode

  def address
    [city, state_province, country].join(', ')
  end

  def send_tweet!
    UserGroupTweeterJob.new.async.perform(id)
  end
{'fraction_non_alphanumeric': 0.10072215887495249, 'fraction_numerical': 0.0068415051311288486, 'mean_word_length': 4.327935222672065, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1273374', 'n_tokens_mistral': 907, 'n_tokens_neox': 849, 'n_words': 226}