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/app/models/meeting.rb b/app/models/meeting.rb index 264cddf61f..5a26b58142 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -43,6 +43,7 @@ class Meeting < ActiveRecord::Base acts_as_searchable columns: ["#{table_name}.title", "#{MeetingContent.table_name}.text"], include: [:contents, :project], + references: :meeting_contents, date_column: "#{table_name}.created_at" acts_as_journalized diff --git a/openproject-meeting.gemspec b/openproject-meeting.gemspec index 9cd18ac7fd..58020a5dde 100644 --- a/openproject-meeting.gemspec +++ b/openproject-meeting.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.files = Dir['{app,config,db,lib,doc}/**/*', 'README.md'] s.test_files = Dir['spec/**/*'] - s.add_dependency 'rails', '~> 4.0.13' + s.add_dependency 'rails', '~> 4.1.11' s.add_development_dependency 'factory_girl_rails', '~> 4.0' end 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