From 53b04b7f9093d55a716d13d24fe31685bc57d411 Mon Sep 17 00:00:00 2001 From: Alex Coles Date: Mon, 13 Jul 2015 18:49:15 +0200 Subject: [PATCH] Migrate model has_many conditions to lambda --- app/models/meeting.rb | 2 +- lib/open_project/meeting/patches/project_patch.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/meeting.rb b/app/models/meeting.rb index 0a40d4d10c..e6bf9e45ee 100644 --- a/app/models/meeting.rb +++ b/app/models/meeting.rb @@ -25,7 +25,7 @@ class Meeting < ActiveRecord::Base belongs_to :author, class_name: 'User', foreign_key: 'author_id' has_one :agenda, dependent: :destroy, class_name: 'MeetingAgenda' has_one :minutes, dependent: :destroy, class_name: 'MeetingMinutes' - has_many :contents, class_name: 'MeetingContent', readonly: true + has_many :contents, -> { readonly }, class_name: 'MeetingContent' has_many :participants, dependent: :destroy, class_name: 'MeetingParticipant' default_scope order("#{Meeting.table_name}.start_time DESC") diff --git a/lib/open_project/meeting/patches/project_patch.rb b/lib/open_project/meeting/patches/project_patch.rb index 3b00320ab4..3c6838036a 100644 --- a/lib/open_project/meeting/patches/project_patch.rb +++ b/lib/open_project/meeting/patches/project_patch.rb @@ -23,7 +23,7 @@ module OpenProject::Meeting module ProjectPatch def self.included(receiver) receiver.class_eval do - has_many :meetings, include: [:author], dependent: :destroy + has_many :meetings, -> { includes(:author) }, dependent: :destroy end end end