1
0
Fork 0
forked from OpenNeo/impress
impress/app/controllers/alt_styles_controller.rb
Emi Matchu 72d4bc65ae API endpoints to load alt styles as JSON, and filter by species
Gonna use this in the app for the alt style picker! Still deciding on
the UI details.
2024-01-28 07:30:06 -08:00

16 lines
407 B
Ruby

class AltStylesController < ApplicationController
def index
@alt_styles = AltStyle.includes(:species, :color, :swf_assets).
order(:species_id, :color_id)
if params[:species_id]
@species = Species.find(params[:species_id])
@alt_styles = @alt_styles.merge(@species.alt_styles)
end
respond_to do |format|
format.html { render }
format.json { render json: @alt_styles }
end
end
end