<commit_before>module Mongoid
  module Scribe
    class DocumentsController < ApplicationController

      layout "mongoid/scribe/layouts/application"

      before_filter :setup_klass, except: [:all]

      def all
      end

      def index
        @documents = @klass.all
      end

      def edit
        @document = @klass.find(params[:id])
      end

      def update
        @document = @klass.find(params[:id])
        @document.update_attributes(document_params)

        redirect_to document_path(params[:type], @document.id)
      end

      def show
        @document = @klass.find(params[:id])
      end

      def destroy
        @document = @klass.find(params[:id])
        @document.destroy

        redirect_to documents_path(params[:type])
      end

    private

      def document_params
        params.require(params[:type].to_sym).permit!<commit_msg>Default sort on index<commit_after>module Mongoid
  module Scribe
    class DocumentsController < ApplicationController

      layout "mongoid/scribe/layouts/application"

      before_filter :setup_klass, except: [:all]

      def all
      end

      def index
        @documents = @klass.all.asc(:created_at)
      end

      def edit
        @document = @klass.find(params[:id])
      end

      def update
        @document = @klass.find(params[:id])
        @document.update_attributes(document_params)

        redirect_to document_path(params[:type], @document.id)
      end

      def show
        @document = @klass.find(params[:id])
      end

      def destroy
        @document = @klass.find(params[:id])
        @document.destroy

        redirect_to documents_path(params[:type])
      end

    private

      def document_params
        params.require(params[:type].to_sym).permit!
{'fraction_non_alphanumeric': 0.09609949123798757, 'fraction_numerical': 0.0, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7483111', 'n_tokens_mistral': 513, 'n_tokens_neox': 496, 'n_words': 106}