ActiveRecord in Rails 3 or Padrino is ignoring GROUP_CONCAT
inside a .select
.
I'm trying to figure out why AcitveRecord is ignoring this query:
Dvd.includes(:dvd_director, :dvd_producer).
select("
GROUP_CONCAT(DISTINCT dvd_director.director SEPARATOR ', ') AS director
, GROUP_CONCAT(DISTINCT dvd_producer.producer SEPARATOR ', ') AS producer
...
.where("id = 4")
The query gets executed but all the GROUP_CONCAT
s get ignored and the info is not in the result. This is a simpliefied version of this question which hasn't been answered.
I read somewhere that you should use .cacluate
for this, but that gives me an error.
What gives?