scinote-web/app/models/result_text.rb

10 lines
373 B
Ruby
Raw Normal View History

2017-06-23 21:19:08 +08:00
class ResultText < ApplicationRecord
auto_strip_attributes :text, nullify: false
validates :text,
presence: true,
2016-11-11 18:42:16 +08:00
length: { maximum: Constants::RICH_TEXT_MAX_LENGTH }
2016-02-12 23:52:43 +08:00
validates :result, presence: true
2017-06-28 21:21:32 +08:00
belongs_to :result, inverse_of: :result_text, optional: true
has_many :tiny_mce_assets, inverse_of: :result_text, dependent: :destroy
2016-02-12 23:52:43 +08:00
end