开发者

How to convert SQL to Arel?

Is there a wa开发者_如何学Cy to convert the MATCH and AGAINST parts to Arel?

I could not find anything about it in the Arel source code.

I'm using Rails 3.

SELECT gigs.time, gigs.channel_id, gigs.song_id, gigs.id, 
  MATCH (songs.title) AGAINST (?) AS song_score,
  MATCH (artists.name) AGAINST (?) AS artist_score
  FROM songs
  INNER JOIN artists ON artists.id = songs.artist_id
  INNER JOIN gigs ON gigs.song_id = songs.id
  WHERE MATCH (artists.name) AGAINST (?) OR
  MATCH (songs.title) AGAINST (?)
  HAVING (artist_score + song_score) > 0


AFAIK there is no Arel MATCH AGAINST implementation. My guess is because it is not pure SQL, but specific to MySQL.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜