<commit_before>class MessagesController < ApplicationController


  def create
    new_message = Message.new(message_params)
    new_message.messageable = return_user
    binding.pry
  end

  private

    def message_params
      params.require(:message).permit(:complaint_id, :text)
    end

    def return_user
      User.first
    end

end
<commit_msg>user now pulled from investigator if logged in<commit_after>class MessagesController < ApplicationController


  def create
    new_message = Message.new(message_params)
    new_message.messageable = return_user(new_message)
    new_message.save
    redirect_to :back
  end

  private

    def message_params
      params.require(:message).permit(:complaint_id, :text)
    end

    def return_user(new_message)
      creating_user = new_message.complaint.user
      current_investigator ? current_investigator : creating_user
    end

end

{'fraction_non_alphanumeric': 0.0592841163310962, 'fraction_numerical': 0.0, 'mean_word_length': 3.61340206185567, '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': '6630962', 'n_tokens_mistral': 272, 'n_tokens_neox': 253, 'n_words': 57}