From 00feac6acf4a6c0d505ce9198dc0ac2561fe1803 Mon Sep 17 00:00:00 2001 From: David Falusi Date: Mon, 26 Aug 2019 21:42:28 +0200 Subject: [PATCH] Update belong_to assocations for the new behaviour `belongs_to` associations are now required by default. --- app/models/group.rb | 2 +- app/models/post_type.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/group.rb b/app/models/group.rb index 270e83cc..4d2bd6e1 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -24,7 +24,7 @@ class Group < ApplicationRecord has_many :point_requests, through: :evaluations has_many :entry_requests, through: :evaluations has_many :children, class_name: :Group, foreign_key: :grp_parent - belongs_to :group, foreign_key: :grp_parent + belongs_to :group, foreign_key: :grp_parent, optional: true alias own_post_types post_types SVIE_ID = 369 diff --git a/app/models/post_type.rb b/app/models/post_type.rb index 78c4b558..be8d544b 100644 --- a/app/models/post_type.rb +++ b/app/models/post_type.rb @@ -6,7 +6,7 @@ class PostType < ApplicationRecord alias_attribute :name, :pttip_name alias_attribute :group_id, :grp_id - belongs_to :group, foreign_key: :grp_id + belongs_to :group, foreign_key: :grp_id, optional: true validates :name, presence: true, length: { maximum: 30 } end