Hi to all,
I want to be able to put alias to my Song.find query.
the artist field belongs to song model so that i could code efficiently
in sorting columns. I want to put an (s) alias to my Song model.
In the code below :select => “artist, g.genre_name AS name_genre”
should be
:select => “s.artist, g.genre_name AS name_genre”
In my controller:
@q = Song.find(:all, :select => “artist, g.genre_name AS name_genre”,
:joins => “LEFT OUTER JOIN genres AS g on songs.genre_id = g.id”, :order
=> params[:sort])
In my view:
Anyone has an idea how to do this?