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
Hi, i had issue when using fields_for with has_many relations
ex. fields_for :accounts
The gem was generating validation attributes but was not validating. In the rails.validations.js I realised that name.replace(..) under validatorsForm regex does not works properly.
It replaces 'setting[profile_attributes][emails_attributes][1][address]' string with setting[profile_attributes][][1][address] which is supposed to be setting[profile_attributes][emails_attributes][][address]
changing this line (https://github.com/bcardarella/client_side_validations/blob/3-2-stable/vendor/assets/javascripts/rails.validations.js?#L47) name = name.replace(/_attributes\]\[\w+\]\[(\w+)\]/g, "_attributes][][$1]"); with name = name.replace(/_attributes\]\[\d+\]/g, "_attributes][]"); (regex found at v3.1.1) solved my issue.
The text was updated successfully, but these errors were encountered:
Hi, i had issue when using fields_for with has_many relations
ex.
fields_for :accounts
The gem was generating validation attributes but was not validating. In the rails.validations.js I realised that name.replace(..) under
validatorsForm
regex does not works properly.It replaces
'setting[profile_attributes][emails_attributes][1][address]'
string withsetting[profile_attributes][][1][address]
which is supposed to besetting[profile_attributes][emails_attributes][][address]
changing this line (https://github.com/bcardarella/client_side_validations/blob/3-2-stable/vendor/assets/javascripts/rails.validations.js?#L47)
name = name.replace(/_attributes\]\[\w+\]\[(\w+)\]/g, "_attributes][][$1]");
withname = name.replace(/_attributes\]\[\d+\]/g, "_attributes][]");
(regex found at v3.1.1) solved my issue.The text was updated successfully, but these errors were encountered: