docbrown/app/models/note.rb
rhymes ba8b3dd443
[deploy] Add missing dependent clauses to User and cleanup relations (#10011)
* Add dependent: :destroy relation to user.notes

* Add cleanup script for orphaned notes

* Reorder relations and reorganize specs in User

* Update specs as notes are not needed after a user is deleted

* Tweets can just be nullified

* Add other cleanup scripts

* Tell the specs we keep tweets

* Fix comments

* Keep page_views and rating_votes when a user is deleted

* Fix specs
2020-08-28 20:19:24 +02:00

6 lines
194 B
Ruby

class Note < ApplicationRecord
belongs_to :author, class_name: "User", optional: true
belongs_to :noteable, polymorphic: true, touch: true
validates :content, :reason, presence: true
end