我如何使用link_to才能正常转到页面上的特定(html)ID如果我想转到我可以使用的页面上的“whatever_id”ClickHere但我想使用我的link_to"mypage",:controller=>"index"},:id=>"#whatever_id"%>辅助方法。有谁知道如何做到这一点?可能吗?rails2.3.4 最佳答案 link_to可以将anchor添加到URL。来自documentation,link_to"Commentwall",profile_path(@profile,:anchor=>"wall
我一直在看maxmethod在Ruby的Enumerable混合(v2.4.1)。这是一个相当简单的方法,但是当存在重复项时它如何排序项目有点令人困惑。例如:x=[1,2,3,4,5,6,7,8,9]x.max{|a,b|a%2b%2}=>110.times{|y|px.max(y){|a,b|a%2b%2}}[][1][1,7]#whyis7thenextelementafter1?[3,1,5]#whynomore7?[7,3,1,5]#7isnowfirst[9,7,3,1,5][9,7,3,1,5,6][9,7,3,1,5,4,6][9,7,3,1,5,2,4,6][9,7,5