<commit_before>class Asset < ActiveRecord::Base

  has_crud paginate: false, settings: false

  dragonfly_accessor :data, app: :file

  scoped_search :on => [:data_name]

  scope :unassociated, -> { where(attributable_type: nil) }
  scope :search_data,  -> query { where("data_name LIKE ?", "%#{query}%") }

  acts_as_taggable

  belongs_to :attributable, polymorphic: true

  validates_presence_of :data
  validates_property :mime_type, of: :data,
    in: Koi::KoiAsset::Document.mime_types, case_sensitive: false

  crud.config do
    fields data: { type: :file, label: false }, tag_list: { type: :tags }
    config(:admin) { form fields: [:data] }
  end

  def titleize
    data.name.sub /\.\w+$/, ''
  end

  def to_s
    File.basename data.name, File.extname(data.name)
  end

end<commit_msg>Fixed a bug causing asset manager to not list assets<commit_after>class Asset < ActiveRecord::Base

  has_crud paginate: false, settings: false

  dragonfly_accessor :data, app: :file

  scoped_search :on => [:data_name]

  scope :unassociated, -> { where("attributable_type IS NULL OR attributable_type = ''") }
  scope :search_data,  -> query { where("data_name LIKE ?", "%#{query}%") }

  acts_as_taggable

  belongs_to :attributable, polymorphic: true

  validates_presence_of :data
  validates_property :mime_type, of: :data,
    in: Koi::KoiAsset::Document.mime_types, case_sensitive: false

  crud.config do
    fields data: { type: :file, label: false }, tag_list: { type: :tags }
    config(:admin) { form fields: [:data] }
  end

  def titleize
    data.name.sub /\.\w+$/, ''
  end

  def to_s
    File.basename data.name, File.extname(data.name)
  end

end
{'fraction_non_alphanumeric': 0.12980769230769232, 'fraction_numerical': 0.0, 'mean_word_length': 3.970149253731343, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1312616', 'n_tokens_mistral': 615, 'n_tokens_neox': 575, 'n_words': 147}