<commit_before>class AreasController < ApplicationController

  before_filter :authenticate_admin!, :only => :destroy
  before_filter :authenticate_user!, :except => [:index, :show]

  before_filter :find_country, :only => [:index, :new, :show, :create, :edit, :update, :destroy]
  before_filter :find_area, :only => [:show, :edit, :update, :destroy]

  def index
    @areas = @country.areas.all(:order => :name)
    respond_to do |format|
      format.html
      format.kml {
        @parent = @areas
        render "plaques/index"
      }
      format.xml
      format.json { render :json => @areas }
    end
  end

  def new
    @area = @country.areas.new
  end

  def show
    @plaques = @area.plaques.paginate(:page => params[:page], :per_page => 100)
    @zoom = 11
    respond_to do |format|
      format.html
      format.kml { 
        @plaques = @area.plaques.all
        render "plaques/index"
      }
      format.osm { render "plaques/index" }
      format.xml
      format.json { render :json => @area.as_json_new({}) }
    end
  end

  def create
    @area = @country.areas.new(params[:area])
    if @area.save
      redirect_to country_area_path(@area.country_alpha2, @area.slug)
    else
      render :new<commit_msg>Fixed area create form submit params<commit_after>class AreasController < ApplicationController

  before_filter :authenticate_admin!, :only => :destroy
  before_filter :authenticate_user!, :except => [:index, :show]

  before_filter :find_country, :only => [:index, :new, :show, :create, :edit, :update, :destroy]
  before_filter :find_area, :only => [:show, :edit, :update, :destroy]

  def index
    @areas = @country.areas.all(:order => :name)
    respond_to do |format|
      format.html
      format.kml {
        @parent = @areas
        render "plaques/index"
      }
      format.xml
      format.json { render :json => @areas }
    end
  end

  def new
    @area = @country.areas.new
  end

  def show
    @plaques = @area.plaques.paginate(:page => params[:page], :per_page => 100)
    @zoom = 11
    respond_to do |format|
      format.html
      format.kml { 
        @plaques = @area.plaques.all
        render "plaques/index"
      }
      format.osm { render "plaques/index" }
      format.xml
      format.json { render :json => @area.as_json_new({}) }
    end
  end

  def create
    @area = @country.areas.new(area_params)
    if @area.save
      redirect_to country_area_path(@area.country_alpha2, @area.slug)
    else
      render :new
{'fraction_non_alphanumeric': 0.1305745279228606, 'fraction_numerical': 0.004821213338690237, 'mean_word_length': 2.7387387387387387, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '802187', 'n_tokens_mistral': 874, 'n_tokens_neox': 841, 'n_words': 194}