<commit_before>
require 'grouped_pagination'
#require 'only_writes_unique'

class Event < ActiveRecord::Base
  has_and_belongs_to_many :data_files #, :unique => true
  has_and_belongs_to_many :publications #, :unique => true
  has_and_belongs_to_many :presentations #, :unique => true

  include Subscribable

  #TODO: refactor to something like 'sorted_by :start_date', which should create the default scope and the sort method. Maybe rename the sort method.
  default_scope :order => "#{self.table_name}.start_date DESC"

  searchable(:ignore_attribute_changes_of=>[:updated_at]) do
    text :address,:city,:country,:url,:description,:title
  end if Seek::Config.solr_enabled

  def self.sort events
    events.sort_by &:start_date
  end<commit_msg>use :uniq option to avoid ActiveRecord::RecordInvalid: Validation failed<commit_after>
require 'grouped_pagination'
#require 'only_writes_unique'

class Event < ActiveRecord::Base
  has_and_belongs_to_many :data_files , :uniq => true
  has_and_belongs_to_many :publications , :uniq => true
  has_and_belongs_to_many :presentations , :uniq => true

  include Subscribable

  #TODO: refactor to something like 'sorted_by :start_date', which should create the default scope and the sort method. Maybe rename the sort method.
  default_scope :order => "#{self.table_name}.start_date DESC"

  searchable(:ignore_attribute_changes_of=>[:updated_at]) do
    text :address,:city,:country,:url,:description,:title
  end if Seek::Config.solr_enabled

  def self.sort events
    events.sort_by &:start_date
  end
{'fraction_non_alphanumeric': 0.09471649484536082, 'fraction_numerical': 0.0, 'mean_word_length': 5.933035714285714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2804730', 'n_tokens_mistral': 508, 'n_tokens_neox': 496, 'n_words': 128}