I have a UserMailer template that is text. Inside the text view I have the following:
<% if !@thing.empty? %>
<% @thing.each do |id, count| %>
<%= #{count}%> <%= #{id} %>
<% end %>
<% end %>
This seems fine but it errors with?
ActionView::Template::Error: /app/views/user_mailer/user_daily_activity.text.erb:12: unterminated string meets end of file
/app/views/user_mailer/myfile.text.erb:12: syntax error, unexpected $end, expecting ')'
Why is Rails erroring on this?
The #{count}
format is only for use within strings, not as a standalone reference. Since you're not using it in a string, the #
is interpreted as a comment.
Try this instead:
<%= count %> <%= id %>
This would also be equivalent:
<%= "#{count} #{id}" %>