我正试图写出不受侵扰的标语 我的看法是:
<%= javascript_include_tag "trend" %>
在我的潮流中,Js.erb有:
$(document).ready(function() {
<% @testsss.each do |t|%>
$( #<%= "t-"+t.id.to_s %> ).click(function(event){
//alert("sometext");
$.ajax({type: "GET", url: "/returngraph?test=<%= t.id.to_s %>", dataType: "html",success:
function(data){ $("#chart").html(data)} });
});
<% end %>
});
But I got NoMethodError... what I am doing wrong? @testsss is set of objects and same @testsss.each works in trend.html.erb from where I call javascript_include_tag "trend"
感谢您,感谢您
编辑 :
这里为实际错误 :
NoMethodError in Statisticall#trend
Showing /xxxx/app/views/statisticall/trend.html.erb where line #1 raised:
undefined method `each for nil:NilClass
(in /xxxx/app/assets/javascripts/trend.js.erb)
Extracted source (around line #1):
1: <%= javascript_include_tag "trend" %>
2: <div id="hhead">
我有控制器 统计与行动趋势