I'm trying to make a chart using Chartkick
and am getting this error: undefined method 'group_by_day' for 10:Fixnum
.
As recommended by this SO post, I installed the gem groupdate
, so that isn't the problem.
My index
method from my tasks_controller
is:
def index
@tasks = Task.where(user_id: current_user.id).order("created_at DESC")
end
And my erb
in tasks#index
is:
<%= line_chart @tasks.map { |task|
{name: task.name, data: task.reps.group_by_day(:created_at)}
} %>
Can anyone see where I'm going wrong here?