From 2d29243a9e61db787a1fe705d05bbd2aefafe4ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 23 Apr 2019 14:53:54 +0200 Subject: [PATCH] Simplify code to link to a poll with one question --- app/views/polls/_poll_group.html.erb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/views/polls/_poll_group.html.erb b/app/views/polls/_poll_group.html.erb index 1de745cdf..95b1660aa 100644 --- a/app/views/polls/_poll_group.html.erb +++ b/app/views/polls/_poll_group.html.erb @@ -29,14 +29,13 @@
- <% if poll.questions.count == 1 %> - <% poll.questions.each do |question| %> -

<%= link_to_poll question.title, poll %>

- <%= poll_dates(poll) %> - <% end %> + <% if poll.questions.one? %> +

<%= link_to_poll poll.questions.first.title, poll %>

+ <%= poll_dates(poll) %> <% else %>

<%= link_to_poll poll.name, poll %>

<%= poll_dates(poll) %> +