Alias Tournament.user to Tournament.owner

This commit is contained in:
Thor77 2018-11-13 23:12:20 +01:00
parent b742b3ed67
commit 556f326acd
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 2 additions and 0 deletions

View File

@ -9,6 +9,8 @@ class Tournament < ApplicationRecord
has_many :teams, dependent: :destroy
belongs_to :user
alias_attribute :owner, :user
after_initialize do |tournament|
tournament.code ||= SecureRandom.hex 3
end