I'm stuck with the following issue in Rails 7 (Ruby 3) with the chartkick and groupdate gems:
I have two child models that I want to group in the following graph:
<%= column_chart @childs.group_by_day(:date, time_zone: false, format: "%d/%m/%y", range: @childs.min_by(&:date).date..Date.current, expand_range: true).count, height: "100px", max: 3 %>
That is, I want to show a chronologically ordered graph grouping the instances of the child models by date.
I have tried the following code in the parent model's controller (show):
@childs = @parent.childs1.pluck(:id, :date) + @parent.childs2.pluck(:id, :date)
also with:
@childs = Child1.where(parent_id: @parent.id).pluck(:id, :date) + Child2.where(parent_id: @parent.id).pluck(:id, :date)
Any idea how to fix it?