hotfix for polls without slugs

This commit is contained in:
rgarcia
2017-10-16 11:46:09 +02:00
committed by Javi Martín
parent 291ae7b734
commit 1af472b795
2 changed files with 3 additions and 3 deletions

View File

@@ -42,7 +42,7 @@ class PollsController < ApplicationController
private private
def load_poll def load_poll
@poll = Poll.find_by(slug: params[:id]) || Poll.find_by(id: params[:id]) @poll = Poll.where(slug: params[:id]).first || Poll.where(id: params[:id]).first
end end
def load_active_poll def load_active_poll

View File

@@ -49,7 +49,7 @@
<% elsif poll.stats_enabled? %> <% elsif poll.stats_enabled? %>
<%= link_to poll.name, stats_poll_path(poll) %> <%= link_to poll.name, stats_poll_path(poll) %>
<% else %> <% else %>
<%= link_to poll.name, poll_path(id: poll.slug) %> <%= link_to poll.name, poll_path(id: poll.slug || poll.id) %>
<% end %> <% end %>
</h4> </h4>
<%= poll_dates(poll) %> <%= poll_dates(poll) %>
@@ -72,7 +72,7 @@
</div> </div>
<div class="small-12 medium-3 column table" data-equalizer-watch> <div class="small-12 medium-3 column table" data-equalizer-watch>
<div class="table-cell align-middle"> <div class="table-cell align-middle">
<%= link_to poll_path(id: poll.slug), class: "button hollow expanded" do %> <%= link_to poll_path(id: poll.slug || poll.id), class: "button hollow expanded" do %>
<% if poll.expired? %> <% if poll.expired? %>
<%= t("polls.index.participate_button_expired") %> <%= t("polls.index.participate_button_expired") %>
<% else %> <% else %>