<commit_before>class Admin::CountriesController < Admin::BaseController
  before_filter :load_country, only: [:edit, :update]
  before_filter :load_news_articles, only: [:edit, :update]

  def index
    @countries = Country.all
  end

  def edit
  end

  def update
    if @country.update_attributes(params[:country])
      redirect_to admin_countries_path, notice: "Country updated successfully"
    else
      render action: :edit
    end
  end

  private

  def load_country
    @country = Country.find(params[:id])
  end

  def load_news_articles
    @news_articles = NewsArticle.published.in_country(@country).by_first_published_at
  end
end<commit_msg>Limit access to editions on countries controller<commit_after>class Admin::CountriesController < Admin::BaseController
  before_filter :load_country, only: [:edit, :update]
  before_filter :load_news_articles, only: [:edit, :update]

  def index
    @countries = Country.all
  end

  def edit
  end

  def update
    if @country.update_attributes(params[:country])
      redirect_to admin_countries_path, notice: "Country updated successfully"
    else
      render action: :edit
    end
  end

  private

  def load_country
    @country = Country.find(params[:id])
  end

  def load_news_articles
    @news_articles = NewsArticle.accessible_to(current_user).published.in_country(@country).by_first_published_at
  end
end
{'fraction_non_alphanumeric': 0.08339376359680928, 'fraction_numerical': 0.0, 'mean_word_length': 4.3076923076923075, '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': '4254658', 'n_tokens_mistral': 433, 'n_tokens_neox': 410, 'n_words': 103}