Hello,
I have following query:
def identifier_register
fr_cost_notes.select_group(:identifier).
select_append {
`array_agg(distinct "month") "months"`
}.
where(company_id: company_id, profit_center_id: profit_center_ids) {
(month >= month_from) & (month <= month_until)
}.to_a
end
and expect a unmapped result like
[
{
:identifier => "BALBOA",
:months => [201601, 201602]
},
{
:identifier => "ROCKY",
:months => [201601, 201602, 201801]
}
]
but get an array of Hanami::Entities without "months", because it is not defined at entity-schema.
I think this worked in previous hanami-versions, but I'm not sure.
Just for info: To workaround the issue, I ended with a hack like this.
def identifier_register
sql = fr_cost_notes.select_group(:identifier).
select_append {
`array_agg(distinct "month") "months"`
}.
where(company_id: company_id, profit_center_id: profit_center_ids) {
(month >= month_from) & (month <= month_until)
}.dataset.sql
fetch(sql, false)
end
best regards