fix posts and boards scaffolds
This commit is contained in:
parent
8cae5955a8
commit
b3a2d5a6f4
|
@ -1,2 +1,3 @@
|
||||||
class Board < ApplicationRecord
|
class Board < ApplicationRecord
|
||||||
|
has_many :posts
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
class Post < ApplicationRecord
|
class Post < ApplicationRecord
|
||||||
|
belongs_to :board
|
||||||
|
has_many :replies, class_name: "Post", foreign_key: "parent_id"
|
||||||
|
belongs_to :parent, class_name: "Post", optional: true
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,8 +10,6 @@ class CreatePosts < ActiveRecord::Migration[7.1]
|
||||||
t.text :message
|
t.text :message
|
||||||
t.text :message_formatted
|
t.text :message_formatted
|
||||||
t.string :password
|
t.string :password
|
||||||
t.datetime :created_at
|
|
||||||
t.datetime :updated_at
|
|
||||||
t.datetime :bumped_at
|
t.datetime :bumped_at
|
||||||
t.datetime :deleted_at
|
t.datetime :deleted_at
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.1].define(version: 2023_12_30_203445) do
|
ActiveRecord::Schema[7.1].define(version: 2023_12_30_205017) do
|
||||||
create_table "boards", force: :cascade do |t|
|
create_table "boards", force: :cascade do |t|
|
||||||
t.string "slug"
|
t.string "slug"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
|
@ -18,4 +18,20 @@ ActiveRecord::Schema[7.1].define(version: 2023_12_30_203445) do
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "posts", force: :cascade do |t|
|
||||||
|
t.integer "board_id"
|
||||||
|
t.integer "parent_id"
|
||||||
|
t.integer "visible_id"
|
||||||
|
t.integer "reply_id"
|
||||||
|
t.string "name"
|
||||||
|
t.string "title"
|
||||||
|
t.text "message"
|
||||||
|
t.text "message_formatted"
|
||||||
|
t.string "password"
|
||||||
|
t.datetime "bumped_at"
|
||||||
|
t.datetime "deleted_at"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue