Oops, fix the pet preview on the homepage

Oh right, I forgot we use the `pet_types#show` endpoint there! Welcome
back lol!
This commit is contained in:
Emi Matchu 2023-11-11 16:09:58 -08:00
parent 75a23dfc57
commit f93944d401
3 changed files with 17 additions and 5 deletions

View file

@ -217,12 +217,9 @@
url:
"/species/" +
type.species +
"/color/" +
"/colors/" +
type.color +
"/pet_type.json",
data: {
for: "image",
},
dataType: "json",
success: function (data) {
var job;

View file

@ -0,0 +1,10 @@
class PetTypesController < ApplicationController
def show
@pet_type = PetType.
where(species_id: params[:species_id]).
where(color_id: params[:color_id]).
first
render json: @pet_type
end
end

View file

@ -16,13 +16,18 @@ OpenneoImpressItems::Application.routes.draw do
get '/your-outfits', to: 'outfits#index', as: :current_user_outfits
get '/users/current-user/outfits', to: redirect('/your-outfits')
# The item database!
# Our customization data! Both the item pages, and JSON API endpoints.
resources :items, :only => [:index, :show] do
resources :appearances, controller: 'item_appearances', only: [:index]
collection do
get :needed
end
end
resources :species do
resources :colors do
get :pet_type, to: 'pet_types#show'
end
end
# Loading and modeling pets!
post '/pets/load' => 'pets#load', :as => :load_pet