-2

The following code isn't working, I need to create css class like 'read-more-105','read-more-106' etc, according to tale.id's vale

<%= simple_format truncate(plot.description, length: char_counter){link_to "Read More",'', class: 'read-more-<% tale.id %>'} %>

1 Answer 1

2

you need string interpolation here:

<%= simple_format truncate(plot.description, length: char_counter){link_to "Read More",'', class: "read-more-#{tale.id}" } %>

As you can not have <% %> inside a <% %> or <%= %>.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.