one meeting per room

This commit is contained in:
Josh
2018-05-14 14:28:18 -04:00
parent 0f8a4734b2
commit 1ddc3172eb
13 changed files with 126 additions and 149 deletions

View File

@ -3,9 +3,10 @@ class Room < ApplicationRecord
before_create :set_uid
belongs_to :user
has_many :meetings
has_one :meeting
def owned_by?(user)
return false if user.nil?
user.room == self
end

View File

@ -68,7 +68,7 @@ class User < ApplicationRecord
# Initializes a room for the user.
def initialize_room
self.room = Room.new
self.save!
room = Room.create(user_id: self.id)
Meeting.create(room_id: room.id, name: "Example")
end
end