Convert the code from PHP to Ruby on rails
- by theband
public function getFtime() {
$records=array();
$sql="SELECT * FROM `finishedtime`";
$result=mysql_query($sql);
if(!$result){throw new Exception(mysql_error());}
if(mysql_num_rows($result)==0){return $records;}
while($row=mysql_fetch_assoc($result)){$records[]=$row;}
return $records;
}
I am in the process of learning Ruby, can anyone convert this code into Ruby. This will make me construe on how to run a query and thrown the fetched result back.