这个数据是从另一个表中获取的,因为我有2种模式,分别存储该ID以仅以这种方式获取该数据,
我需要在switch / case语句中编写以下代码
@pfold=""
if(employeeproof.proof.id == 1 )
@pfold = employeeproof.proof_value
end
@pfnew=""
if(employeeproof.proof.id == 1 )
@pfold = employeeproof.proof_value
end
like this i have 20 conditions can any one tell me how to write this one in switch/case statement in rails
你可以这样写:-
case employeeproof.proof.id
when 1 then @pfold = employeeproof.proof_value
so on...
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句