<commit_before>class PositionApplicationsController < ApplicationController

  before_filter :authorize_call_admin, except: [:index, :show]

  def index
  end

  def show
    @position_application = PositionApplication.find(params[:id])
    respond_to do |format|
      format.fragment
    end
  end

  def new
    call = Call.find params[:call_id]
    @position_application = call.position_applications.build(user_id: @user._id)

    respond_to do |format|
      format.fragment
    end
  end

  def edit
  end

  def create
    position_application_params = params[:position_application] || {}
    call = Call.find params[:call_id]
    @position_application = FactoryGirl.create :position_application,
      position_application_params.merge(call: call)
  end

  def update
    position_application = PositionApplication.find params[:id]
    position_params = params[:position_application]
    position_application.set_position! position_params
    respond_to do |format|
      format.json { render :json => position_application }
    end
  end

  def destroy
  end

end<commit_msg>Use update_attributes (and the internal set_position handling) for position application also<commit_after>class PositionApplicationsController < ApplicationController

  before_filter :authorize_call_admin, except: [:index, :show]

  def index
  end

  def show
    @position_application = PositionApplication.find(params[:id])
    respond_to do |format|
      format.fragment
    end
  end

  def new
    call = Call.find params[:call_id]
    @position_application = call.position_applications.build(user_id: @user._id)

    respond_to do |format|
      format.fragment
    end
  end

  def edit
  end

  def create
    position_application_params = params[:position_application] || {}
    call = Call.find params[:call_id]
    @position_application = FactoryGirl.create :position_application,
      position_application_params.merge(call: call)
  end

  def update
    position_application = PositionApplication.find params[:id]
    position_params = params[:position_application]
    position_application.update_attributes! position_params
    respond_to do |format|
      format.json { render :json => position_application }
    end
  end

  def destroy
  end

end
{'fraction_non_alphanumeric': 0.07282415630550622, 'fraction_numerical': 0.0, 'mean_word_length': 3.9299781181619258, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6027442', 'n_tokens_mistral': 641, 'n_tokens_neox': 618, 'n_words': 155}