<commit_before>class VersionsController < ApplicationController

  resource_controller

  actions :index, :show, :create

  belongs_to :package

  before_filter :admin_required, :only => :create

  protect_from_forgery :except => :trigger

  index.wants.html { rescue_404 }
  index.wants.xml { render :xml => collection }

  show.failure.wants.html { rescue_404 }

  create.wants.xml { render :xml => object }
  create.failure.wants.xml { render :nothing => true, :status => :conflict }

  def feed
    @versions = Version.recent
    respond_to do |format|
      format.atom
    end
  end

  def trigger
    Version.find(params[:id]).serialize_data
    render :nothing => true
  end

  private
  def parent_object
    # Find the parent package object with the param instead of numeric id
    Package.find_by_param(params[:package_id])
  end

end<commit_msg>VersionsController no longer use resource_controller<commit_after>class VersionsController < ApplicationController

  before_filter :admin_required, :only => :create

  protect_from_forgery :except => :trigger

  def index
    respond_to do |format|
      format.html { rescue_404 }
      format.xml { render :xml => Version.all }
    end
  end

  def show
    @version = Version.find(params[:id])
    @package = @version.package
  rescue ActiveRecord::RecordNotFound
    rescue_404
  end

  def create
    @version = Version.new(params[:version])
    if @version.save
      render :xml => @version
    else
      render :nothing => true, :status => :conflict
    end
  end

  def feed
    @versions = Version.recent
    respond_to do |format|
      format.atom
    end
  end

  def trigger
    Version.find(params[:id]).serialize_data
    render :nothing => true
  end

end
{'fraction_non_alphanumeric': 0.09069901790872328, 'fraction_numerical': 0.006932409012131715, 'mean_word_length': 3.276543209876543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '656606', 'n_tokens_mistral': 540, 'n_tokens_neox': 509, 'n_words': 141}