I need to form a query in Arel which had a CAST operation earlier. The original query was like : select * from tablename where tablename.anniversary >= CAST(STR_TO_DATE(?,'%d-%m-%Y-%k-%i-%s') as DATETIME)
(the question mark is replaced by actual date in further code)
For the where condition, I am doing this :
where(tablename['anniversary']
.gteq("CAST(STR_TO_DATE(#{date_value},'%d-%m-%Y %k:%i') as DATETIME)"))
The final resulting query that I should get should have : tablename.anniversary >= '2015-07-13 16:12:00'
But I get :
tablename.anniversary >= 'CAST(STR_TO_DATE(13-09-2015 05:33PM,\'%d-%m-%Y %k:%i\') as DATETIME)'
What am I doing wrong ?