I am trying to access a attribute from a table named cities
from the User model
. the two table are associated.
I want to make a pie-chart of the user cities, am using chartkick (you can check it out I have given the link)
in my view I have:
<%= pie_chart User.city.group("name").count %>
someone advise me, since it is not working.
update:
<%= pie_chart User.group("city_id").count %>
, it is able to group the number of users per city but the label is city id
I want to improve the chart to have the label of the city names