parent
cf9831c0af
commit
11a59aadfb
8 changed files with 47 additions and 18 deletions
|
@ -36,6 +36,7 @@ class DiaryEntry < ApplicationRecord
|
|||
has_many :subscribers, :through => :subscriptions, :source => :user
|
||||
|
||||
scope :visible, -> { where(:visible => true) }
|
||||
scope :visible_to, ->(user) { where(:visible => true).or(where(:user => user)) unless user&.moderator? || user&.administrator? }
|
||||
|
||||
validates :title, :presence => true, :length => 1..255, :characters => true
|
||||
validates :body, :presence => true, :characters => true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue