I know this must have existed and I did follow some answers that seems to be a duplicate question, so, I followed https://stackoverflow.com/a/5858236/5614748, but am having a little issue.
**Am trying to output the highest occurring email address from a table and show it in the view.
This is what I have done:
show action
module Admin
module Statistic
class TrafficsController < BaseController
def show
@signup_grid = ::Statistic::TrafficsGrid.new(params[:statistic_traffics_grid])
@history_assets = @signup_grid.assets
@highest_occurrence = Hash[@history_assets.group_by {|x| x}.map {|k,v| [k.email,v.count]}]
@summary = {
:highest_occurrence_account => @highest_occurrence # this is my output and I have uploaded the hash it outputs instead of the email alone.
}
@traffic_filter = true
end
end
end
end
instance variable @highest_occurrence
my output