I've tried to insert some Values into this hash were every key is an array but when I print all result just the last value
def self.hash_builder(query)
statistic = Hash.new { |hash, key| hash[key] = [] }
if !query.empty?
query.each do |q|
statistic[:sell].push(q.total_sell.to_i)
statistic[:price].push(q.total_price.to_f)
end
else
statistic[:sell].push(0)
statistic[:price].push(0.0)
end
return statistic
end
I call this method after make a query, and I send to this the query with the new params, but every time i see inside this hash just the last query value
THIS IS THE RESULT

queryat the top of the method?statistic[:sell] << q.total_sell.to_i.puts query.inspector similar (in text); not a screenshot of your app, as we don't know what you did to produce the screenshot.Array#pushandArray#<<are almost identical, where one works the other should too (except for the valence ofpush).