Postgresql Functions

Hello, trying to construct the following query using ROM

select repos.*, 
           json_agg(row_to_json(reports.*)) as reports 
from repos 
left join reports on 
repos.id = reports.repo_id 
group by repos.id;

However when constructing the query I’m getting

undefined method `meta' for #<Module:0x00000000064a9830>
file: attribute.rb location: meta line: 309

and my query looks like

   select { [:id, :name, array::json_agg(json::row_to_json(:reports__id, :reports__name)) ] }
    .left_join(reports, repo_id: :id).group(:id)

Anyone have any ideas?

was able to aggregate the rows into json, but cannot seem to filter the json_agg using the filter function.

 select do 
       [:id, 
        :name, 
        string::coalesce(
          string::json_agg(
            string::json_build_object(
                'id',
                Sequel[:reports][:id],
                'name',
                Sequel[:reports][:name],
                'body',
                Sequel[:reports][:framework]
            )
          ),
          '[]'
        ).as(:reports),