Reputation: 26264
According to the documentation, #truncate can accept a block, but it is not including it!
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-truncate
2.0.0p247 :310 > helper.truncate("Once upon a time in a world far far away") { link_to "Continue", "#" }
=> "Once upon a time in a world..."
How do I include the block with truncate?
Rails 3.2.14.
Upvotes: 0
Views: 57
Reputation: 18080
I think the block part is new in rails 4.0.
http://apidock.com/rails/v3.2.13/ActionView/Helpers/TextHelper/truncate
It looks like you would do this sort of thing
helper.truncate("Once upon a time in a world far far away", :omission => link_to("Continue", "#"))
Upvotes: 1