-# id :integer not null, primary key
-# note_id :integer not null
+# id :bigint(8) not null, primary key
+# note_id :bigint(8) not null
-class NoteComment < ActiveRecord::Base
- belongs_to :note, :foreign_key => :note_id, :touch => true
- belongs_to :author, :class_name => "User", :foreign_key => :author_id
+class NoteComment < ApplicationRecord
+ belongs_to :note, :touch => true
+ belongs_to :author, :class_name => "User"
validates :id, :uniqueness => true, :presence => { :on => :update },
validates :id, :uniqueness => true, :presence => { :on => :update },
validates :note, :presence => true, :associated => true
validates :visible, :inclusion => [true, false]
validates :author, :associated => true
validates :event, :inclusion => %w[opened closed reopened commented hidden]
validates :note, :presence => true, :associated => true
validates :visible, :inclusion => [true, false]
validates :author, :associated => true
validates :event, :inclusion => %w[opened closed reopened commented hidden]
- validates :body, :length => { :maximum => 2000 },
- :format => /\A[^\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff]*\z/
+ validates :body, :length => { :maximum => 2000 }, :characters => true