Skip to content

Commit

Permalink
Explicitily cast title to string
Browse files Browse the repository at this point in the history
When iterating through the `items` hash in the important-metadata
partial, the `title` will be of type Symbol. Calling `sanitize` on a
Symbol fails.

Cast it to a string so we can call sanitize.
  • Loading branch information
Bevan Loon committed Mar 18, 2019
1 parent 896e4a3 commit afabaf9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/views/components/_important-metadata.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
<% if items.any? %>
<div class="app-c-important-metadata<%= margin_bottom_class %>">
<% if title %>
<h2 class="app-c-important-metadata__title"><%= sanitize(title) %></h2>
<h2 class="app-c-important-metadata__title"><%= sanitize title %></h2>
<% end %>
<dl data-module="track-click">
<% items.each do |title, definition| %>
<dt class="app-c-important-metadata__term"><%= sanitize (title) %>: </dt>
<dd class="app-c-important-metadata__definition"><%= sanitize (definition) %></dd>
<dt class="app-c-important-metadata__term"><%= sanitize title.to_s %>: </dt>
<dd class="app-c-important-metadata__definition"><%= sanitize definition %></dd>
<% end %>
</dl>
</div>
Expand Down

0 comments on commit afabaf9

Please sign in to comment.