Add custom validator and fix .html_safe with rescue
This commit is contained in:
1 parent
ecb75fd085
commit
9f859b903d
16 files changed
+32
-16
No files matched your search
@@ -0,0 +1,7 @@
|
||||
class AtLeastOneValidator < ActiveModel::EachValidator
|
||||
|
||||
def validate_each(record, attribute, value)
|
||||
record.errors[attribute] << (options[:message] || I18n.t("errors.at_least_one")) if (value.blank? || value.values.join.eql?(''))
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user