2010-05-16 12:01:38 -07:00
|
|
|
class SwfAssetsController < ApplicationController
|
|
|
|
def index
|
2010-05-20 16:56:08 -07:00
|
|
|
if params[:item_id]
|
2010-05-20 18:30:12 -07:00
|
|
|
@swf_assets = Item.find(params[:item_id]).swf_assets
|
|
|
|
if params[:body_id]
|
|
|
|
@swf_assets = @swf_assets.fitting_body_id(params[:body_id])
|
2010-06-08 15:26:42 -07:00
|
|
|
else
|
|
|
|
@swf_assets = @swf_assets.fitting_standard_body_ids
|
|
|
|
json = @swf_assets.for_json.all.group_by(&:body_id)
|
2010-05-20 18:30:12 -07:00
|
|
|
end
|
2010-05-20 16:56:08 -07:00
|
|
|
elsif params[:pet_type_id]
|
2010-05-20 18:30:12 -07:00
|
|
|
@swf_assets = PetType.find(params[:pet_type_id]).pet_states.first.swf_assets
|
2010-05-20 16:56:08 -07:00
|
|
|
end
|
2010-06-07 13:33:43 -07:00
|
|
|
json ||= @swf_assets.for_json.all
|
|
|
|
render :json => json
|
2010-05-16 12:01:38 -07:00
|
|
|
end
|
|
|
|
end
|