<commit_before>module Api
  module V1
    class FriendshipsController < ApplicationController
      before_action :authenticate_user!, only: [:create, :update, :destroy]
      
      def create
        @friendship = Friendship.create(friendship_params)
        @user = User.find_by(id: @friendship.user_id)
        render json: @user
      end

      def show
        set_friendship
        render json: @friendship
      end

      def index
        @friendships = Friendship.all
        render json: @friendships
      end

      def destroy
        set_friendship
        @friendship.destroy
        @friendships = Friendship.all
        render json: @friendships
      end

      private
      def set_friendship
        @item = Friendship.find_by(id: params[:id])
      end

      def friendship_params
        params.require(:friendships).permit(:id, :user_id, :friend_id)
      end
    end
  end
end
<commit_msg>friendship.json now working, had @item in set_friendship friendship_controller<commit_after>module Api
  module V1
    class FriendshipsController < ApplicationController
      before_action :authenticate_user!, only: [:create, :update, :destroy]
      
      def create
        @friendship = Friendship.create(friendship_params)
        @user = User.find_by(id: @friendship.user_id)
        render json: @user
      end

      def show
        set_friendship
        render json: @friendship
      end

      def index
        @friendships = Friendship.all
        render json: @friendships
      end

      def destroy
        set_friendship
        @friendship.destroy
        @friendships = Friendship.all
        render json: @friendships
      end

      private
      def set_friendship
        @friendship = Friendship.find_by(id: params[:id])
      end

      def friendship_params
        params.require(:friendships).permit(:id, :user_id, :friend_id)
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.06966998428496594, 'fraction_numerical': 0.0010476689366160294, 'mean_word_length': 2.220910623946037, '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': '407483', 'n_tokens_mistral': 547, 'n_tokens_neox': 534, 'n_words': 137}