<commit_before>class PetsController < ApplicationController
  before_action :find_pet, only: [:show, :edit, :update, :destroy]

  def index
    @pets = Pet.all

    render json: @pets.as_json
  end

  def show
    render json: @pet
  end

  def new
    @pet = Pet.new
  end

  def create
    @pet = Pet.create(pets_params)
  end

  def update
    @pet.update(pets_params)
  end

  def destroy
    @pet.destroy
  end

private

  def find_pet
      @pet = Pet.find(params[:id])
  end

  def pets_params
    #need to rewrite this eventually to include .require(:pet)
    #http://stackoverflow.com/questions/13745689/getting-rails-api-and-strong-parameters-to-work-together
    params.permit(:name, :category, :breed, :birthdate, :sex, :adoption_date, :picture_url, :user_id, :veterinarian_id)
  end


end
<commit_msg>added nested attributes to show method in pets controller<commit_after>class PetsController < ApplicationController
  before_action :find_pet, only: [:show, :edit, :update, :destroy]

  def index
    @pets = Pet.all

    render json: @pets.as_json
  end

  def show
    render json: @pet, include:   [:veterinarian,
                                  :conditions,
                                  :expenses,
                                  # :medications,
                                  # :appointments,
                                  # :supplies
                                ]
  end

  def new
    @pet = Pet.new
  end

  def create
    @pet = Pet.create(pets_params)
  end

  def update
    @pet.update(pets_params)
  end

  def destroy
    @pet.destroy
  end

private

  def find_pet
      @pet = Pet.find(params[:id])
  end

  def pets_params
    #need to rewrite this eventually to include .require(:pet)
    #http://stackoverflow.com/questions/13745689/getting-rails-api-and-strong-parameters-to-work-together
    params.permit(:name, :category, :breed, :birthdate, :sex, :adoption_date, :picture_url, :user_id, :veterinarian_id)
  end


end

{'fraction_non_alphanumeric': 0.09731373542828181, 'fraction_numerical': 0.008109477952356817, 'mean_word_length': 2.2682119205298013, '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': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1863928', 'n_tokens_mistral': 674, 'n_tokens_neox': 624, 'n_words': 155}