Sha256: 630b9a1c71e41c82b363e813808953e85f15546f86e4c2a901782f306b95de92
Contents?: true
Size: 571 Bytes
Versions: 3
Compression:
Stored size: 571 Bytes
Contents
class Topic < ActiveObject::Base attribute :title,:content,:create_time,:user_key,:posts before_create do |object| object.create_time = Time.now end validates_presence_of :title,:content validate_on_create :title_is_wrong_create def validate_on_create if content == "Mismatch" errors.add("title", "is Content Mismatch") end end def title_is_wrong_create errors.add("title", "is Wrong Create") if title == "Wrong Create" end def validate_on_update errors.add("title", "is Wrong Update") if title == "Wrong Update" end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
zeng-0.0.1 | ./spec/model/Topic.rb |
activeobject-0.0.3 | ./spec/model/topic.rb |
activeobject-0.0.4 | ./spec/model/topic.rb |