<commit_before>class Asset < ActiveRecord::Base
  has_attachment :storage => :file_system,
                 :path_prefix => 'public/assets',
                 :max_size => 5.megabytes,
                 :resize_to => '900',
                 :thumbnails => { :large => '480x480', :medium => '230x230', :thumb => '184', :square => '75x75!' }
                 
  has_many :assetings, :dependent => :delete_all
  belongs_to :assetable, :polymorphic => true
  
  named_scope :not_thumbnails, :conditions => 'parent_id IS NULL'
  named_scope :images, :conditions => "content_type LIKE 'image%'"
  named_scope :documents, :conditions => "content_type NOT LIKE 'image%'"
                 
  validates_as_attachment
  # validates_presence_of :description, :unless => :is_thumbnail?
  
  attr_accessor :position
  attr_accessible :category, :description, :uploaded_data
  
  def description
    read_attribute('description').blank? ? 'No Description' : super
  end
  
  def category
    read_attribute('category').blank? ? 'No Folder' : super
  end
  
  def is_thumbnail?
    !parent_id.nil?
  end
  
  def file_type
    self.content_type.split("/")[1]
  end
  
  def is_image?
    content_type =~ /image/
  end
  
  def self.grouped_by_content_type
    self.not_thumbnails.group_by(&:content_type).sort
  end
  
  def self.grouped_by_category
    self.not_thumbnails.group_by(&:category).sort
  end
  
  def self.categories
    self.find(:all, :group => "category", :select => "category", :order => 'category')
  end
  
  def sizes
    sizes = []
    if is_image? and not is_thumbnail?
      sizes << [ 'fullsize', public_filename ]
      attachment_options[:thumbnails].each_key do |key|
        sizes << [key.to_s, public_filename(key)]
      end
    end
    sizes
  end
  
  def to_json(options = {})
    methods = [:public_filename]
    methods << :sizes if is_image?
    options.reverse_merge! :methods => methods
    super options
  end


end
<commit_msg>up the max upload size to 7 meg inline with the changes to the js<commit_after>class Asset < ActiveRecord::Base
  has_attachment :storage => :file_system,
                 :path_prefix => 'public/assets',
                 :max_size => 7.megabytes,
                 :resize_to => '900',
                 :thumbnails => { :large => '480x480', :medium => '230x230', :thumb => '184', :square => '75x75!' }
                 
  has_many :assetings, :dependent => :delete_all
  belongs_to :assetable, :polymorphic => true
  
  named_scope :not_thumbnails, :conditions => 'parent_id IS NULL'
  named_scope :images, :conditions => "content_type LIKE 'image%'"
  named_scope :documents, :conditions => "content_type NOT LIKE 'image%'"
                 
  validates_as_attachment
  # validates_presence_of :description, :unless => :is_thumbnail?
  
  attr_accessor :position
  attr_accessible :category, :description, :uploaded_data
  
  def description
    read_attribute('description').blank? ? 'No Description' : super
  end
  
  def category
    read_attribute('category').blank? ? 'No Folder' : super
  end
  
  def is_thumbnail?
    !parent_id.nil?
  end
  
  def file_type
    self.content_type.split("/")[1]
  end
  
  def is_image?
    content_type =~ /image/
  end
  
  def self.grouped_by_content_type
    self.not_thumbnails.group_by(&:content_type).sort
  end
  
  def self.grouped_by_category
    self.not_thumbnails.group_by(&:category).sort
  end
  
  def self.categories
    self.find(:all, :group => "category", :select => "category", :order => 'category')
  end
  
  def sizes
    sizes = []
    if is_image? and not is_thumbnail?
      sizes << [ 'fullsize', public_filename ]
      attachment_options[:thumbnails].each_key do |key|
        sizes << [key.to_s, public_filename(key)]
      end
    end
    sizes
  end
  
  def to_json(options = {})
    methods = [:public_filename]
    methods << :sizes if is_image?
    options.reverse_merge! :methods => methods
    super options
  end


end

{'fraction_non_alphanumeric': 0.11690283400809717, 'fraction_numerical': 0.012398785425101215, 'mean_word_length': 2.949050949050949, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 41, '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': '3349799', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1286, 'n_words': 294}