lib/rasti/form.rb in rasti-form-3.0.0 vs lib/rasti/form.rb in rasti-form-3.1.0
- old
+ new
@@ -143,10 +143,14 @@
target.nil? ? nil : target.public_send(attr_name)
end
end
def assert_present(attribute)
- assert attribute, !fetch(attribute).nil?, 'not present'
+ assert attribute, !fetch(attribute).nil?, 'not present' unless errors.key? attribute
+ end
+
+ def assert_not_present(attribute)
+ assert attribute, fetch(attribute).nil?, 'is present'
end
def assert_not_empty(attribute)
if assert_present attribute
value = fetch attribute
\ No newline at end of file