Create lecture model
This commit is contained in:
parent
86b8846f20
commit
a496965d81
9
app/models/lecture.rb
Normal file
9
app/models/lecture.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class Lecture < ApplicationRecord
|
||||||
|
enum :status, [
|
||||||
|
:future,
|
||||||
|
:live,
|
||||||
|
:attended,
|
||||||
|
:watched,
|
||||||
|
:missed,
|
||||||
|
]
|
||||||
|
end
|
||||||
12
db/migrate/20230929171214_create_lectures.rb
Normal file
12
db/migrate/20230929171214_create_lectures.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class CreateLectures < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
create_table :lectures do |t|
|
||||||
|
t.string :title, null: false
|
||||||
|
t.datetime :start_time, null: false
|
||||||
|
t.integer :status, null: false
|
||||||
|
t.string :recording_id, null: false
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
13
test/fixtures/lectures.yml
vendored
Normal file
13
test/fixtures/lectures.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
title: MyString
|
||||||
|
start_time: 2023-09-29 18:12:14
|
||||||
|
status: 1
|
||||||
|
recording_id: MyString
|
||||||
|
|
||||||
|
two:
|
||||||
|
title: MyString
|
||||||
|
start_time: 2023-09-29 18:12:14
|
||||||
|
status: 1
|
||||||
|
recording_id: MyString
|
||||||
7
test/models/lecture_test.rb
Normal file
7
test/models/lecture_test.rb
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class LectureTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue
Block a user