Skip to content

Commit

Permalink
Merge pull request #904 from samudary/888/bugfix/render-announcements…
Browse files Browse the repository at this point in the history
…-nil-description

[Bugfix] Use safe nav operator to handle nil descriptions on announcement index page
  • Loading branch information
solebared authored Mar 16, 2021
2 parents bfd4d39 + 3b5d0ac commit 70455bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/announcements/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<li class="box">
<p class="title is-5"><%= announcement.name %></p>
<p>
<%= announcement.description.truncate(100) %>
<%= link_to("More [*]", announcement_path(announcement)) if announcement.description.length > 100 %>
<%= announcement.description&.truncate(100) %>
<%= link_to("More [*]", announcement_path(announcement)) if announcement.description&.length.to_i > 100 %>
</p>
<% if policy(announcement).change? %>
<footer class="level is-mobile mt-1">
Expand Down

0 comments on commit 70455bc

Please sign in to comment.