Created
January 4, 2011 09:18
-
-
Save liwh/764571 to your computer and use it in GitHub Desktop.
valid? 方法会清空errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> c.errors.add_on_blank('instructor','not be blank') | |
=> ["instructor"] | |
>> c.errors | |
=> #<ActiveRecord::Errors:0xb01f150c @errors={"instructor"=>["not be blank"]}, @base=#<Conversation id: "3e7f4481-e96b-012d-7fdc-042b2b5ce4fb", state: 10, tag: "20101214-2-00022", title: "死亡索赔", aim: 1, emergency: 1, security: 1, kind_id: 1, content: "当事人利爱琼称有29人来我厂索赔,事�...", record_id: nil, district: "440310008000", ownerdistrict: "440310008000", sub_kind_id: 199, place: "坑梓", source: 3, reportor_id: "3e7f4480-e96b-012d-7fdc-042b2b5ce4fb", reported_at: "2010-12-14 12:46:00", levels: 2, finishdate: "2011-01-27 00:00:00", advice: "请司法所处理,并将处理结果于15个工作...", remark: nil, flag: 1, creator_id: "57ec3557-c4dc-4ac8-87a6-a13ad4104686", modifier_id: "57ec3557-c4dc-4ac8-87a6-a13ad4104686", dispatched_at: "2010-12-16 18:29:35", finished_at: nil, created_at: "2010-12-14 12:47:57", updated_at: "2010-12-31 17:59:31", count: nil, grid_id: nil, building_id: nil, warndate: "2011-01-25 00:00:00", dealdistrict: "440310008000", instruct: "同意拟办意见.", is_instruct: 0, advicer_id: "39022d40-e97c-012d-8003-042b2b5ce4fb", department_id: "68061b50-d28a-012d-c214-001321c95b62", serial_dep: nil, instructor_id: nil, utag: "10008201012A99023">> | |
>> c.errors.empty? | |
=> false | |
>> c.errors.empty? | |
=> false | |
>> c.errors.empty? | |
=> false | |
>> c.errors.empty? | |
=> false | |
>> c.valid? | |
=> true | |
>> c.errors.empty? | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment