<commit_before># -*- encoding : utf-8 -*-
class Page < ActiveRecord::Base
  attr_accessible :name, :body, :title, :translations_attributes, as: :admin

  translates :body, :title
  accepts_nested_attributes_for :translations
  validates :name, :presence => true, :uniqueness => true

  class Resolver < ActionView::Resolver
    self.caching = false

    protected
      def find_templates(name, prefix, partial, details)
        ::Page.where(:name => name).map do |record|
          initialize_template(record)
        end
      end

      # Initialize an ActionView::Template object based on the record found.
      def initialize_template(record)
        source = record.body
        identifier = "DbPageTemplate - pages/#{record.name}"
        handler = ActionView::Template.registered_template_handler('erb')
        details = {
          :format => Mime['html'],
          :updated_at => record.updated_at,
          :virtual_path => "pages/#{record.name}"
        }
        ActionView::Template.new(source, identifier, handler, details)
      end
  end

end<commit_msg>fix: Static page reload on change<commit_after># -*- encoding : utf-8 -*-
class Page < ActiveRecord::Base
  attr_accessible :name, :body, :title, :translations_attributes, as: :admin

  translates :body, :title
  accepts_nested_attributes_for :translations
  validates :name, :presence => true, :uniqueness => true

  class Resolver < ActionView::Resolver
    self.caching = false

    protected
      def find_templates(name, prefix, partial, details)
        ::Page.where(:name => name).map do |record|
          initialize_template(record)
        end
      end

      # Initialize an ActionView::Template object based on the record found.
      def initialize_template(record)
        source = record.body
        identifier = "DbPageTemplate - pages/#{I18n.locale}_#{record.name}"
        handler = ActionView::Template.registered_template_handler('erb')
        details = {
          :format => Mime['html'],
          :updated_at => record.updated_at,
          :virtual_path => "pages/#{I18n.locale}_#{record.name}"
        }
        ActionView::Template.new(source, identifier, handler, details)
      end
  end

  after_save { self.touch }
end
{'fraction_non_alphanumeric': 0.11310592459605028, 'fraction_numerical': 0.0026929982046678637, 'mean_word_length': 3.016216216216216, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '6155680', 'n_tokens_mistral': 631, 'n_tokens_neox': 617, 'n_words': 154}