I have an array of arrays, and when I loop through the array the only one displayed is the last array.
Here is the code that loops through the arrays;
@events.each do |event|
def get_sig_class_id(sig_id)
IpsSignature.where('sig_id =?', sig_id).first.sig_class_id
end
sig_id = get_sig_class_id(event.signature)
event_class_data.push(sig_id)
@event_class_array = Array.new(event_class_data.group_by {|x| x}.map {|k,v| [k,v.count]})
@event_class_array.each do |x|
@event_class = x
end
end
If I display @event_class_array in my view I get this [[1, 54], [30, 1], [2, 1]]
If I display @event_class in the view I only get [2, 1]
I'm looking to get [1, 54], [30, 1], [2, 1] with @event_class (single arrays, not an array of arrays as in @event_class_array, and not just the last one).
My displaying in the view is simply to see what data I'm getting returned, this will eventually end up in a Highcharts pie chart.
Here are my views, nothing much to see here..
<%= @event_class_array %>
and
<%= @event_class %>