[英]Truncate helper on a link_to Rails
Is it possible to truncate a link_to within rails using the truncate helper of course, I have this link_to in my app 当然可以使用截断帮助程序在rails中截断link_to,我的应用程序中有这个link_to
<%= link_to b.bookname, b %>
This is within a .each do so i am passing through b for example 这在.each内,例如,我通过b
messed around with a few variations but unable to get to work at present, 杂乱无章,但目前无法正常工作,
Anyone done this before? 有人做过吗?
Thanks 谢谢
使用截断助手
<%= link_to truncate(b.bookname, :length => 5), b %>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.