Fix queries and scopes after column deletion

Some queries were accessing original column instead of the new
translatable one. This should have been causing unexpected behavior
for requests maded in a different locale than the application default.
This commit is contained in:
Senén Rodero Rodríguez
2019-01-17 20:11:11 +01:00
committed by Julian Herrero
parent 1a21b779ac
commit 596ef8d1ed
6 changed files with 6 additions and 5 deletions

View File

@@ -67,6 +67,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController
end
def poll_params
image_attributes = [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy]
attributes = [:name, :starts_at, :ends_at, :geozone_restricted, :results_enabled,
:stats_enabled, :budget_id, geozone_ids: [],
image_attributes: image_attributes]

View File

@@ -19,7 +19,7 @@ module Budgets
.group_by(&:heading)
else
@budget.investments.winners
.joins(:milestones).includes(:milestones)
.joins(milestones: :translations)
.distinct.group_by(&:heading)
end
end

View File

@@ -11,7 +11,7 @@ class PollsController < ApplicationController
::Poll::Answer # trigger autoload
def index
@polls = @polls.not_budget.send(@current_filter).includes(:geozones).sort_for_list.page(params[:page])
@polls = @polls.not_budget.send(@current_filter).sort_for_list.page(params[:page])
end
def show