Skip to content

Commit

Permalink
Add schema information to models
Browse files Browse the repository at this point in the history
  • Loading branch information
hmlON committed Jul 29, 2017
1 parent 1b52ad1 commit d15c910
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/models/activity.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Activity is a record of completed RoomActivity by someone
#
# == Schema Information
#
# Table name: activities
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# user_id :integer
# room_activity_id :integer
#
class Activity < ApplicationRecord
belongs_to :user
belongs_to :room_activity
Expand Down
10 changes: 10 additions & 0 deletions app/models/room.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# A room is a place where users who live in that room do activities like
# 'taking out trash' with their roommates
#
# == Schema Information
#
# Table name: rooms
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# name :integer not null
#
class Room < ApplicationRecord
has_many :users
has_many :room_activities, dependent: :destroy
Expand Down
12 changes: 12 additions & 0 deletions app/models/room_activity.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Room activities are activities that room uses
#
# == Schema Information
#
# Table name: room_activities
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# name character :string
# room_id :integer
# enabled :boolean DEFAULT(true)
#
class RoomActivity < ApplicationRecord
DEFAULT_ROOM_ACTIVITIES = [
'taking out trash',
Expand Down
11 changes: 11 additions & 0 deletions app/models/room_request.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# Room requests are requests for joining the room
#
# == Schema Information
#
# Table name: room_requests
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# room_id :integer
# sender_id :integer
#
class RoomRequest < ApplicationRecord
belongs_to :room
belongs_to :sender, class_name: 'User'
Expand Down
16 changes: 16 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# User is a preson, who lives in a hostel room
#
# == Schema Information
#
# Table name: room_requests
#
# id :integer not null, primary key
# created_at :datetime
# updated_at :datetime
# name :string DEFAULT(''), not null
# email :string DEFAULT(''), not null
# encrypted_password :string DEFAULT(''), not null
# room_id :integer
# provider :string
# uid :string
# photo_url :string
#
class User < ApplicationRecord
belongs_to :room, optional: true
has_many :activities
Expand Down

0 comments on commit d15c910

Please sign in to comment.