G
Gleb Mazovetskiy
Is there a way to express this with associations?
@songs = Song.find_by_sql(%Q{
SELECT songs.*, song_playlist_relationships.playlist_id
FROM songs INNER JOIN song_playlist_relationships
ON songs.id = song_playlist_relationships.song_id
WHERE song_playlist_relationships.playlist_id IN
(#{@playlists.collect{|p| p.id}.join(',')})})
Thank you,
Gleb
@songs = Song.find_by_sql(%Q{
SELECT songs.*, song_playlist_relationships.playlist_id
FROM songs INNER JOIN song_playlist_relationships
ON songs.id = song_playlist_relationships.song_id
WHERE song_playlist_relationships.playlist_id IN
(#{@playlists.collect{|p| p.id}.join(',')})})
Thank you,
Gleb