<commit_before>#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

class Post < ActiveRecord::Base
  require File.join(Rails.root, 'lib/diaspora/web_socket')
  include ApplicationHelper
  include ROXML
  include Diaspora::Webhooks
  include Diaspora::Guid

  xml_attr :diaspora_handle
  xml_attr :public
  xml_attr :created_at

  has_many :comments, :order => 'created_at ASC'
  has_many :likes, :conditions => '`likes`.`positive` = 1'
  has_many :dislikes, :conditions => '`likes`.`positive` = 0', :class_name => 'Like'
  has_many :post_visibilities
  has_many :aspects, :through => :post_visibilities
  has_many :mentions, :dependent => :destroy
  belongs_to :author, :class_name => 'Person'

  cattr_reader :per_page
  @@per_page = 10

  def user_refs
    self.post_visibilities.count
  end
<commit_msg>dependent destroy for likes<commit_after>#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

class Post < ActiveRecord::Base
  require File.join(Rails.root, 'lib/diaspora/web_socket')
  include ApplicationHelper
  include ROXML
  include Diaspora::Webhooks
  include Diaspora::Guid

  xml_attr :diaspora_handle
  xml_attr :public
  xml_attr :created_at

  has_many :comments, :order => 'created_at ASC'
  has_many :likes, :conditions => '`likes`.`positive` = 1', :dependent => :destroy
  has_many :dislikes, :conditions => '`likes`.`positive` = 0', :class_name => 'Like', :dependent => :destroy
  has_many :post_visibilities
  has_many :aspects, :through => :post_visibilities
  has_many :mentions, :dependent => :destroy
  belongs_to :author, :class_name => 'Person'

  cattr_reader :per_page
  @@per_page = 10

  def user_refs
    self.post_visibilities.count
  end

{'fraction_non_alphanumeric': 0.1074468085106383, 'fraction_numerical': 0.009574468085106383, 'mean_word_length': 4.631736526946108, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '1632121', 'n_tokens_mistral': 668, 'n_tokens_neox': 629, 'n_words': 173}