From 79fae723f094c69eff6232ba9f61774090bf9385 Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 24 Nov 2018 11:21:22 +0200 Subject: [PATCH] Allow giving feedback for events of old editions of the current conference --- app/controllers/public/event_feedbacks_controller.rb | 2 +- app/models/conference.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/public/event_feedbacks_controller.rb b/app/controllers/public/event_feedbacks_controller.rb index 4953d39..fab2938 100644 --- a/app/controllers/public/event_feedbacks_controller.rb +++ b/app/controllers/public/event_feedbacks_controller.rb @@ -32,6 +32,6 @@ class Public::EventFeedbacksController < Public::ApplicationController end def approved_events - current_conference.events.joins(:proposition).approved + current_conference.events_of_all_editions.joins(:proposition).approved end end diff --git a/app/models/conference.rb b/app/models/conference.rb index 4b9532f..7634779 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -23,6 +23,8 @@ class Conference < ActiveRecord::Base has_many :participant_profiles, class_name: 'PersonalProfile' has_many :slots, through: :halls has_many :feedbacks, as: :feedback_receiving, dependent: :destroy + has_many :editions, primary_key: :host_name, foreign_key: :host_name, class_name: 'Conference' + has_many :events_of_all_editions, through: :editions, source: :events accepts_nested_attributes_for :tracks, :halls, :event_types, :volunteer_teams, reject_if: :all_blank, allow_destroy: true