jquery - Rails Javascript haml variable creation -
i have code pasted below creation of variables in javascript rails + javascript variables
:javascript $( ".form-control" ).each(function( index ) { var mix = $( ).attr("id").split("_"); var e_array = mix.shift(); var e_name = mix.join("_"); var error = "#{@account.errors[:" + e_name +"]}"; //var error = error[":" + ]; alert(error); console.log( "#{@account.errors}"); });
why array return empty?
try "#{@account.errors['"+e_name+"']}";
Comments
Post a Comment