<commit_before>class Feature < ActiveRecord::Base
  attr_accessor :skip_update
  
  include FeatureExtensionForNamePositioning
  extend IsDateable
  
  validates_presence_of :fid
  validates_uniqueness_of :fid
  validates_numericality_of :position, :allow_nil=>true

  # after_save {|record| record.update_hierarchy}  
  # acts_as_solr :fields=>[:pid]
  
  acts_as_family_tree :node, :tree_class => 'FeatureRelation', :conditions => {'feature_relations.feature_relation_type_id' => FeatureRelationType.hierarchy_ids}
  # These are distinct from acts_as_family_tree's parent/child_relations, which only include hierarchical parent/child relations.
  has_many :all_child_relations, :class_name => 'FeatureRelation', :foreign_key => 'parent_node_id'
  has_many :all_parent_relations, :class_name => 'FeatureRelation', :foreign_key => 'child_node_id'
  has_many :altitudes, :dependent => :destroy
  has_many :association_notes, :foreign_key => "notable_id"
  has_many :cached_feature_names
  has_many :category_features, :dependent => :destroy
  has_many :citations, :as => :citable, :dependent => :destroy
  has_many :contestations
  has_many :cumulative_category_feature_associations, :dependent => :destroy
  has_many :descriptions, :dependent => :destroy
  has_many :feature_object_types, :order => :position
  has_many :geo_codes, :class_name=>'FeatureGeoCode' # naming inconsistency here (see feature_object_types association) ?
  has_many :geo_code_types, :through=>:geo_codes<commit_msg>adding dependencies to deletions to avoid db getting corrupted.<commit_after>class Feature < ActiveRecord::Base
  attr_accessor :skip_update
  
  include FeatureExtensionForNamePositioning
  extend IsDateable
  
  validates_presence_of :fid
  validates_uniqueness_of :fid
  validates_numericality_of :position, :allow_nil=>true

  # after_save {|record| record.update_hierarchy}  
  # acts_as_solr :fields=>[:pid]
  
  acts_as_family_tree :node, :tree_class => 'FeatureRelation', :conditions => {'feature_relations.feature_relation_type_id' => FeatureRelationType.hierarchy_ids}
  # These are distinct from acts_as_family_tree's parent/child_relations, which only include hierarchical parent/child relations.
  has_many :all_child_relations, :class_name => 'FeatureRelation', :foreign_key => 'parent_node_id', :dependent => :destroy
  has_many :all_parent_relations, :class_name => 'FeatureRelation', :foreign_key => 'child_node_id', :dependent => :destroy
  has_many :altitudes, :dependent => :destroy
  has_many :association_notes, :foreign_key => "notable_id", :dependent => :destroy
  has_many :cached_feature_names, :dependent => :destroy
  has_many :category_features, :dependent => :destroy
  has_many :citations, :as => :citable, :dependent => :destroy
  has_many :contestations, :dependent => :destroy
  has_many :cumulative_category_feature_associations, :dependent => :destroy
  has_many :descriptions, :dependent => :destroy
  has_many :feature_object_types, :order => :position, :dependent => :destroy
  has_many :geo_codes, :class_name=>'FeatureGeoCode', :dependent => :destroy # naming inconsistency here (see feature_object_types association) ?
  has_many :geo_code_types, :through=>:geo_codes
{'fraction_non_alphanumeric': 0.101875, 'fraction_numerical': 0.0, 'mean_word_length': 7.10379746835443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '2602424', 'n_tokens_mistral': 1019, 'n_tokens_neox': 984, 'n_words': 217}