1

我正在从数据库中获取一些结果:

@log_detail = connection.execute("SELECT logs,setup FROM mastertest WHERE test_ins_id LIKE blah blah blah");

结果

 logs = a/atf/something
 setup = tb-1-atf with ac-2115 

我想

logs = atf/something
setup = 2115

我为日志尝试了以下操作,但它似乎不起作用

@log_detail.each do |row|
    row[0] = row[0].drop(2) 
end
4

1 回答 1

1

尝试:

row[0] = row[0][2..-1]

并查看String[]上的方法。

于 2013-03-07T00:50:56.293 回答