You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From my understanding we may need to add return if options.allow_nil == true as well there
And also replace the line hash[:allow_blank] = true if options[:allow_blank]
with hash[:allow_blank] = true if options[:allow_nil] || options[:allow_blank]
I use the following validation in my Rails model:
Unfortunately it does not allow me to save empty field value, I'm getting the following error when submit a form:
Looks like it comes from here
https://github.com/DavyJonesLocker/client_side_validations/blob/master/coffeescript/rails.validations.coffee#L287
From my understanding we may need to add
return if options.allow_nil == true
as well thereAnd also replace the line
hash[:allow_blank] = true if options[:allow_blank]
with
hash[:allow_blank] = true if options[:allow_nil] || options[:allow_blank]
here https://github.com/DavyJonesLocker/client_side_validations/blob/master/lib/client_side_validations/active_model/length.rb#L30
So you already have it for 'numeric' validation here https://github.com/DavyJonesLocker/client_side_validations/blob/master/lib/client_side_validations/active_model/numericality.rb#L44
so I propose to do the same for 'length' validation
Do you have any issues with the suggestion?
I use Rails 4.2 and 4.2.12 version of this gem but it looks like the issue is persist on master as well
The text was updated successfully, but these errors were encountered: