Вопрос

I have the following find_by_sql and am getting a 'too few arguments' error. Any ideas to fix? Would like to just keep it as a find_by_sql

dates=find_by_sql(['select DATE(start_datetime) date_only,  DATE_FORMAT(start_datetime,\'\%b \%D\') as formatted_date from events where area_id=1 group by date_only'])

thx

Это было полезно?

Решение

You need to use double percentage symbols to escape a percentage inside of a finder:

dates = find_by_sql(['select DATE(start_datetime) date_only,  DATE_FORMAT(start_datetime,\'\%%b \%%D\') as formatted_date from events where area_id=1 group by date_only'])
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top