<commit_before>class ParameterGroupsController < ApplicationController
  before_action :set_parameter_group, only: [:show, :edit, :update, :destroy]

  # GET /parameter_groups
  # GET /parameter_groups.json
  def index
    @parameter_groups = ParameterGroup.all
  end

  # GET /parameter_groups/1
  # GET /parameter_groups/1.json
  def show
  end

  # GET /parameter_groups/new
  def new
    @parameter_group = ParameterGroup.new
  end

  # GET /parameter_groups/1/edit
  def edit
  end

  # POST /parameter_groups
  # POST /parameter_groups.json
  def create
    @parameter_group = ParameterGroup.new(parameter_group_params)

    respond_to do |format|
      if @parameter_group.save
        format.html { redirect_to @parameter_group, notice: 'Parameter group was successfully created.' }
        format.json { render action: 'show', status: :created, location: @parameter_group }
      else
        format.html { render action: 'new' }
        format.json { render json: @parameter_group.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /parameter_groups/1
  # PATCH/PUT /parameter_groups/1.json
  def update
    respond_to do |format|
      if @parameter_group.update(parameter_group_params)
        format.html { redirect_to @parameter_group, notice: 'Parameter group was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: 'edit' }
        format.json { render json: @parameter_group.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /parameter_groups/1
  # DELETE /parameter_groups/1.json
  def destroy
    @parameter_group.destroy
    respond_to do |format|
      format.html { redirect_to parameter_groups_url }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_parameter_group
      @parameter_group = ParameterGroup.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def parameter_group_params
      params.require(:parameter_group).permit(:name, :description, :pgn, :priority, :default_rate, :database_version, :pgn_category_id, :pgn_type_id, :size, :repeating_fields, :is_known)
    end
end
<commit_msg>Added nested fields as permitted attributes<commit_after>class ParameterGroupsController < ApplicationController
  before_action :set_parameter_group, only: [:show, :edit, :update, :destroy]

  # GET /parameter_groups
  # GET /parameter_groups.json
  def index
    @parameter_groups = ParameterGroup.all
  end

  # GET /parameter_groups/1
  # GET /parameter_groups/1.json
  def show
  end

  # GET /parameter_groups/new
  def new
    @parameter_group = ParameterGroup.new
  end

  # GET /parameter_groups/1/edit
  def edit
  end

  # POST /parameter_groups
  # POST /parameter_groups.json
  def create
    @parameter_group = ParameterGroup.new(parameter_group_params)

    respond_to do |format|
      if @parameter_group.save
        format.html { redirect_to @parameter_group, notice: 'Parameter group was successfully created.' }
        format.json { render action: 'show', status: :created, location: @parameter_group }
      else
        format.html { render action: 'new' }
        format.json { render json: @parameter_group.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /parameter_groups/1
  # PATCH/PUT /parameter_groups/1.json
  def update
    respond_to do |format|
      if @parameter_group.update(parameter_group_params)
        format.html { redirect_to @parameter_group, notice: 'Parameter group was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: 'edit' }
        format.json { render json: @parameter_group.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /parameter_groups/1
  # DELETE /parameter_groups/1.json
  def destroy
    @parameter_group.destroy
    respond_to do |format|
      format.html { redirect_to parameter_groups_url }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_parameter_group
      @parameter_group = ParameterGroup.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def parameter_group_params
      params.require(:parameter_group).permit(:name, :description, :pgn, :priority, :default_rate, :database_version, :pgn_category_id, :pgn_type_id, :size, :repeating_fields, :is_known, parameter_group_fields_attributes: [:id, :field_id, :parameter_group_id, :order, :byte_position, :bit_position])
    end
end

{'fraction_non_alphanumeric': 0.08443882922720573, 'fraction_numerical': 0.0029479890503263844, 'mean_word_length': 3.451733833177132, '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': '1076357', 'n_tokens_mistral': 1415, 'n_tokens_neox': 1390, 'n_words': 374}