<commit_before>class ArticlesController < ApplicationController

  def index
    @articles = Article.all
  end

  def show
    @article = Article.find params[:id]
  end
  
  def new
  end

  def create
    @article = Article.new article_params
    if @article.valid?
      @article.save
      redirect_to @article
    else
      render action: 'new'
    end
  end

  def edit
    @article = Article.find params[:id]
  end

  private

  def article_params # allowing attributes from params[]
    params.require(:article).permit(:title, :text)
  end

end
<commit_msg>Create articles#update<commit_after>class ArticlesController < ApplicationController

  def index
    @articles = Article.all
  end

  def show
    @article = Article.find params[:id]
  end
  
  def new
  end

  def create
    @article = Article.new article_params
    if @article.valid?
      @article.save
      redirect_to @article
    else
      render action: 'new'
    end
  end

  def edit
    @article = Article.find params[:id]
  end

  def update
    @article = Article.find params[:id]
    if @article.update(article_params)
      redirect_to @article
    else
      render action: 'edit'
    end
  end

  private

  def article_params # allowing attributes from params[]
    params.require(:article).permit(:title, :text)
  end

end

{'fraction_non_alphanumeric': 0.07862595419847328, 'fraction_numerical': 0.0, 'mean_word_length': 2.7138810198300285, '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': '2541560', 'n_tokens_mistral': 407, 'n_tokens_neox': 389, 'n_words': 116}