From d614f74d1eac174ef2252f27a8c8c9210b124f1b Mon Sep 17 00:00:00 2001 From: wolak88 Date: Mon, 2 Nov 2015 14:02:33 +0100 Subject: [PATCH] Fix "required" option evaluation --- lib/html5_validators/action_view/form_helpers.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/html5_validators/action_view/form_helpers.rb b/lib/html5_validators/action_view/form_helpers.rb index 75bb35a..a284499 100644 --- a/lib/html5_validators/action_view/form_helpers.rb +++ b/lib/html5_validators/action_view/form_helpers.rb @@ -14,7 +14,8 @@ def form_for(record, options = {}, &block) module PresenceValidator def render if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false) - @options["required"] ||= @options[:required] || object.class.attribute_required?(@method_name) + @options["required"] = @options[:required] if @options["required"].nil? + @options["required"] = object.class.attribute_required?(@method_name) if @options["required"].nil? end super end