1
0
Fork 0
forked from OpenNeo/impress

return nil, not 500, when missing certain swf_assets.json param

This commit is contained in:
Emi Matchu 2010-11-15 16:04:54 -05:00
parent 41aa9008fc
commit 98d908d33c

View file

@ -8,7 +8,7 @@ class SwfAssetsController < ApplicationController
@swf_assets = @swf_assets.fitting_standard_body_ids @swf_assets = @swf_assets.fitting_standard_body_ids
json = @swf_assets.all.group_by(&:body_id) json = @swf_assets.all.group_by(&:body_id)
end end
elsif params[:body_id] elsif params[:body_id] && params[:item_ids]
swf_assets = SwfAsset.arel_table swf_assets = SwfAsset.arel_table
rels = ParentSwfAssetRelationship.arel_table rels = ParentSwfAssetRelationship.arel_table
@swf_assets = SwfAsset.select('swf_assets.*, parents_swf_assets.parent_id'). @swf_assets = SwfAsset.select('swf_assets.*, parents_swf_assets.parent_id').
@ -23,7 +23,7 @@ class SwfAssetsController < ApplicationController
elsif params[:pet_type_id] elsif params[:pet_type_id]
@swf_assets = PetType.find(params[:pet_type_id]).pet_states.first.swf_assets @swf_assets = PetType.find(params[:pet_type_id]).pet_states.first.swf_assets
end end
json ||= @swf_assets.all json ||= @swf_assets ? @swf_assets.all : nil
render :json => json render :json => json
end end
end end