ruby-on-rails – Rails 3 – 如何在视图中发表评论?
发布时间:2020-12-16 20:23:06 所属栏目:百科 来源:网络整理
导读:什么是Rails 3方式在视图中注释掉一行或多行代码?所以它不会出现在HTML源代码中 解决方法 注释掉一行ob ruby??代码使用 %# code %or for multiple lines%=begin your code=end% 编辑: 这是一个在视图中注释掉一个循环的示例. = begin和= end必须直接在行的
什么是Rails 3方式在视图中注释掉一行或多行代码?所以它不会出现在HTML源代码中
解决方法
注释掉一行ob ruby??代码使用
<%# code %> or for multiple lines <% =begin your code =end %> 编辑: <h1>Listing posts</h1> <table> <tr> <th>Title</th> <th>Text</th> <th></th> <th></th> <th></th> </tr> <% =begin %> <%@posts.each do |post| %> <tr> <td><%= post.title %></td> <td><%= post.text %></td> <td><%= link_to 'Show',post %></td> <td><%= link_to 'Edit',edit_post_path(post) %></td> <td><%= link_to 'Destroy',post,:confirm => 'Are you sure?',:method => :delete %></td> </tr> <% end %> <% =end %> </table> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |