<commit_before>class ArticlesController < ApplicationController
  before_action :get_article, only: [:show, :edit, :update]

  def show
    redirect_to article_version_path(@article, @article.latest_version)
  end

  def index
    @featured_articles = Article.featured
  end

  def search
    @search_param = params[:q]
    @search_results = Article.search(@search_param)
    render :search
  end

  def new
    @article = Article.new
    @article.versions.build
  end

  def show
    @article = Article.find(params[:id])
    redirect_to article_version_path(@article, @article.latest_version)
  end

  def create
    @article = Article.new(article_params)
    @article.versions.first.author = current_user

    if @article.save
      redirect_to article_version_path(@article, @article.latest_version)
    else
      render 'new'
    end
  end

  private
  def article_params
    params.require(:article).permit(:title, versions_attributes: [:content])
  end

  def get_article<commit_msg>duplicate article show action removed<commit_after>class ArticlesController < ApplicationController
  before_action :get_article, only: [:show, :edit, :update]

  def show
    redirect_to article_version_path(@article, @article.latest_version)
  end

  def index
    @featured_articles = Article.featured
  end

  def search
    @search_param = params[:q]
    @search_results = Article.search(@search_param)
    render :search
  end

  def new
    @article = Article.new
    @article.versions.build
  end

  def create
    @article = Article.new(article_params)
    @article.versions.first.author = current_user

    if @article.save
      redirect_to article_version_path(@article, @article.latest_version)
    else
      render 'new'
    end
  end

  private
  def article_params
    params.require(:article).permit(:title, versions_attributes: [:content])
  end

  def get_article
{'fraction_non_alphanumeric': 0.08649225840896957, 'fraction_numerical': 0.0, 'mean_word_length': 3.768447837150127, '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': '3383888', 'n_tokens_mistral': 577, 'n_tokens_neox': 555, 'n_words': 131}