質問

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