论坛首页 入门讨论版 ruby

Activescaffold里的for循环里的判断问题

浏览 74 次
该帖已经被评为新手帖
作者 正文
时间:2008-05-12
@tccom042s=Tccom042.find_by_sql("select id ,sg from tccom042s")
for @i in 0..2
@first =@tccom042s[@i]
@sg=@first.id.to_s
puts "-----------heelooeooweriwer----------"+@sg
打印的结果是15,16,17,本意是当@sg为15的出现a的连接,16,17的时候就出现b的连接,但列表中只出现了a的连接,指针就指向了第一条记录,没有next.请帮忙,谢谢!

if(@sg==15)
conf.nested.add_link("a", [:tccom043s])

else
conf.nested.add_link "b", [:tccom043s]

end

end
   
论坛首页 入门讨论版 ruby

跳转论坛:
JavaEye推荐