开发者

How to convert SQL to Arel?

开发者 https://www.devze.com 2023-02-22 13:28 出处:网络
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.

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

精彩评论

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