Q: can any one tell me how to do this one n case/switch statement in rails this data im getting from another table becauase i have 2 modes which is separately storing this id's to fetch that data only im doing like this
 i need to write this below code in switch/case statement
@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


A: Do it like :
case employeeproof.proof.id
when 1
// Do Something here...
break
when 2
// Do Something here...
break
else
// Do Something here...
break
end


A: You can write it like :-
case employeeproof.proof.id
  when 1 then @pfold = employeeproof.proof_value
  so on...
end

