mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Add comments controller and routes
This commit is contained in:
@@ -2,6 +2,7 @@ class Post < ApplicationRecord
|
||||
belongs_to :board
|
||||
belongs_to :user
|
||||
belongs_to :post_status, optional: true
|
||||
has_many :comments
|
||||
|
||||
validates :title, presence: true, length: { in: 4..64 }
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ class User < ApplicationRecord
|
||||
:recoverable, :rememberable, :validatable,
|
||||
:confirmable
|
||||
|
||||
has_many :comments
|
||||
|
||||
enum role: [:user, :moderator, :admin]
|
||||
after_initialize :set_default_role, if: :new_record?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user