1
我已經粘貼代碼下面創建的變量在JavaScript與導軌+ JavaScript的變量的Rails的JavaScript HAML變量創建
:javascript
$(".form-control").each(function(index) {
var mix = $(this).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}");
});
爲什麼數組返回空?