# POST /bumonsdef create@bumon = Bumon.new(params[:bumon])bumonsyozoku = Bumonsyozoku.newrespond_to do |format|if @bumon.savebumonsyozoku.bumon_id = @bumon.idbumonsyozoku.syozokbumon_id = @bumon.idbumonsyozoku.syozokulevel = 0bumonsyozoku.saveflag = params[:bumonsyozoku]["syozokubumon_id"]if flag !=nil && flag !=""parent_bumon = Bumonsyozoku.find(:all, :conditions => "bumon_id = #{flag}")parent_bumon.each{|x| y=Bumonsyozoku.new ; y.bumon_id = @bumon.id; y.syozokulevel = x.syozokulevel + 1;y.syozokbumon_id=x.syozokbumon_id; y.save}endflash[:notice] = 'Bumon was successfully created.'format.ext_json { render :json => @bumon.to_ext_json(:success => true) }elseformat.ext_json { render :json => @bumon.to_ext_json(:success => false) }endendend
1 回答
吃鸡游戏
TA贡献1829条经验 获得超7个赞
rsepc 的话
describe 'bumons测试' do
before do
post :bumons,{ #你的测试数据}
end
it '逻辑测试' do
#你的逻辑
end
it '返回数据测试' do
#你期待的返回数据
end
end
- 1 回答
- 0 关注
- 55 浏览
添加回答
举报
0/150
提交
取消