Skip to content

Commit a844fee

Browse files
authored
25: Use simple_format to display puzzle questions (#38)
Render puzzle question with line breaks Use Rails' simple_format helper to display puzzle questions with preserved line breaks in the table view. This improves readability for questions containing newline characters from the database. See: https://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html
1 parent 2101f5a commit a844fee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/views/puzzles/_puzzles_table.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<tbody>
1515
<% puzzles.each do |puzzle| %>
1616
<tr id="<%= dom_id(puzzle) %>">
17-
<td><%= puzzle.question %></td>
17+
<td><%= simple_format(puzzle.question) %></td>
1818
<td><%= puzzle.answer %></td>
1919
<td><%= puzzle.explanation %></td>
2020
<td>
@@ -47,4 +47,4 @@
4747
</tr>
4848
<% end %>
4949
</tbody>
50-
</table>
50+
</table>

0 commit comments

Comments
 (0)