I have a text field called content that I need to display an excerpt of.
What is the best way to do this?
Something like:
<% post.content.slice(0..50) %>
is what I have in mind; however, this gives me an argument error.
What is the best way to display the first 50 characters of the content text field?
Alternatively - could I create an excerpt field when the data is created/saved into the database?
Any help is appreciated. Thanks in advance.
String.slice(post.content, 0..50), please check this answer - stackoverflow.com/a/39395092/3102718 - Alex Avoiants