Sha256: 3503b1e8654a28129de5620ef63948e00605c818b785ad81c48486e9f554cf42
Contents?: true
Size: 819 Bytes
Versions: 2
Compression:
Stored size: 819 Bytes
Contents
require 'models/topic' class Reply < Topic validate :errors_on_empty_content validate :title_is_wrong_create, on: :create validate :check_empty_title validate :check_content_mismatch, on: :create validate :check_wrong_update, on: :update def check_empty_title errors[:title] << "is Empty" unless title && title.size > 0 end def errors_on_empty_content errors[:content] << "is Empty" unless content && content.size > 0 end def check_content_mismatch if title && content && content == "Mismatch" errors[:title] << "is Content Mismatch" end end def title_is_wrong_create errors[:title] << "is Wrong Create" if title && title == "Wrong Create" end def check_wrong_update errors[:title] << "is Wrong Update" if title && title == "Wrong Update" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activejob-lock-0.0.2 | rails/activemodel/test/models/reply.rb |
activejob-lock-0.0.1 | rails/activemodel/test/models/reply.rb |