简体   繁体   中英

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

<%= link_to b.bookname, b %>

This is within a .each do so i am passing through b for example

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 %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM