<commit_before>class MoodsController < ApplicationController
  before_action :correct_user, only: :destroy

  def create
    @mood = current_user.moods.build(mood_params)
    if @mood.save
      flash[:success] = "Saved!"
      redirect_to root_url
    end
  end

  def destroy
    @mood.destroy
    redirect_to user_url(current_user)
  end

  private

  def mood_params
    params.require(:mood).permit(:state)
  end

  def correct_user
    @mood = current_user.moods.find_by_timestamp!(params[:id]) or redirect_to(root_url)
  end
end<commit_msg>Add latitude and longitude to permits<commit_after>class MoodsController < ApplicationController
  before_action :correct_user, only: :destroy

  def create
    @mood = current_user.moods.build(mood_params)
    if @mood.save
      flash[:success] = "Saved!"
      redirect_to root_url
    end
  end

  def destroy
    @mood.destroy
    redirect_to user_url(current_user)
  end

  private

  def mood_params
    params.require(:mood).permit(:state, :latitude, :longitude)
  end

  def correct_user
    @mood = current_user.moods.find_by_timestamp!(params[:id]) or redirect_to(root_url)
  end
end
{'fraction_non_alphanumeric': 0.08588957055214724, 'fraction_numerical': 0.0, 'mean_word_length': 3.8389830508474576, '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': '4494056', 'n_tokens_mistral': 397, 'n_tokens_neox': 381, 'n_words': 82}