views:

67

answers:

2

I have this rails find that i need to get the id as well but if i put the id in the :select wont it effect the query and is there another way to get the id

@past_requests = Request.find_all_by_artist(name, :conditions => ["showdate < ?", Time.now], :select => "distinct venue, showdate")
+1  A: 

To be fair in cases where distinct returns a single row out of maybe 5 duplicates who's to say which id out of those 5 should be displayed in your result? I'm afraid what you are asking for is not practical. Maybe you misunderstand what distinct is used for ? Give us more info pls.

Hugo
+1  A: 
@past_requests = Request.find_all_by_artist(name, :group => "venue, showdate")

code long for view. i'm remove your condition. sorry about this. Hope it'll helpful for you. :)

Nam Khanh