From 8b88eb921f607582d5477d6430510556e037b2f9 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Sat, 29 Aug 2015 19:40:36 +0200 Subject: [PATCH] Fix obsolete finder in MeetingsController Signed-off-by: Alex Coles --- app/controllers/meetings_controller.rb | 4 +++- spec/controllers/meetings_controller_spec.rb | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/meetings_controller.rb b/app/controllers/meetings_controller.rb index 3a7b1723e6..cbdab31bf1 100644 --- a/app/controllers/meetings_controller.rb +++ b/app/controllers/meetings_controller.rb @@ -133,7 +133,9 @@ class MeetingsController < ApplicationController end def find_meeting - @meeting = Meeting.find(params[:id], include: [:project, :author, { participants: :user }, :agenda, :minutes]) + @meeting = Meeting + .includes([:project, :author, { participants: :user }, :agenda, :minutes]) + .find(params[:id]) @project = @meeting.project rescue ActiveRecord::RecordNotFound render_404 diff --git a/spec/controllers/meetings_controller_spec.rb b/spec/controllers/meetings_controller_spec.rb index 35078e1b3a..69573cc2c5 100644 --- a/spec/controllers/meetings_controller_spec.rb +++ b/spec/controllers/meetings_controller_spec.rb @@ -52,7 +52,7 @@ describe MeetingsController, type: :controller do describe 'show' do before(:each) do @m = mock_model(Meeting) - allow(Meeting).to receive(:find).and_return(@m) + allow(Meeting).to receive_message_chain(:includes, :find).and_return(@m) allow(@m).to receive(:project).and_return(@p) allow(allow(@m).to receive(:agenda)).to receive(:present?).and_return(false) end @@ -84,7 +84,7 @@ describe MeetingsController, type: :controller do describe 'edit' do before(:each) do @m = mock_model(Meeting) - allow(Meeting).to receive(:find).and_return(@m) + allow(Meeting).to receive_message_chain(:includes, :find).and_return(@m) allow(@m).to receive(:project).and_return(@p) end describe 'html' do