Skip to content

Commit

Permalink
Update belong_to assocations for the new behaviour
Browse files Browse the repository at this point in the history
`belongs_to` associations are now required by default.
  • Loading branch information
falusi94 committed Aug 26, 2019
1 parent 5905c9d commit 00feac6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/group.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/post_type.rb
Expand Up @@ -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

0 comments on commit 00feac6

Please sign in to comment.