How does one convert ARRAY_TO_STRING and ARRAY_AGG into arel?

Viewed 769

I have an Arel statement that looks like the following:

vulns.project(vulns[:id],
              vulns[:cve_id],
              vulns[:severity],
              vulns[:published_on],
              vulns[:description],
  "ARRAY_TO_STRING((ARRAY_AGG(#{releases[:version]} ORDER BY #{releases[:released_on]} DESC))[1:10], ', ')")
  .join(releases_vulns)
    .on(releases_vulns[:vulnerability_id].eq(vulns[:id]))

The toughest part that I am running into is the array_agg and array_to_string. I've checked arel documentation and I did not see a particular matching method to work out a query like this. Has anyone encountered this problem? I could use some help. Thank You.

1 Answers
Related