I have some code that works in “normal” RoR.
It doesn’t work in JRuby with the MySql JDBC adapter.
The query is:
@breakdowns = Client.find(:all,
:select => breakdown_select,
:conditions =>breakdown_conditions ,
:joins => breakdown_joins,
:group => breakdown_group,
:order=> ‘record_count desc’)
Which shows up in the log as:
Client Load (0.000000) SELECT clients.client_status as
breakdown_id,count(clients.client_status)as record_count FROM clients
left join programmes on clients.programme_id = programmes.id WHERE
(clients.programme_id = 12 ) GROUP BY clients.client_status ORDER BY
This is fine…
But when I try to access the “breakdown_id” column from the query
(clients.client_status as breakdown_id) it fails with:
NoMethodError (undefined method `breakdown_id’ for #<Client:
for breakdown in @breakdowns
This has been working fine until I tried to deploy with JRuby.
Any ideas… surely I can alias column names?