docbrown/app/models/note.rb
Andy Zhao ecbb9d4ab1 [Done] New Reporting System MVP (#408)
* Move validations from controller to model

* Add new columns to feedback message model

* Use polymorphic notes relationship

* MVP of ticketing system

* Use new URL for reported_url param

* Add missing files

* Add validations and tests for feedback_messages

* Clean up some html

* Update create spec and add update spec

* Add mail tests and lint

* Add link to user profile
2018-06-19 16:41:31 -04:00

6 lines
240 B
Ruby

class Note < ApplicationRecord
belongs_to :noteable, polymorphic: true
validates :reason, :content, presence: true
validates :noteable_id, uniqueness:
{ scope: :reason, message: "limited to one note per noteable per reason" }
end