Discussion Forums
- Topic List
- Most Recent Posts
- Sign In for more options
Hai,
In the following query Place is acts_as_mappable_model and it has associations to some other model. The Query is to list all location which are nearest to the origin in ascending order. Yes, I am getting the list of locations in the order But I want list some fields from the associated model, In the following query ads.
I mean, I want the query result as place.name,ads.title
locations = Place.find(:all,:limit=>30,:origin => 'calicut',:conditions => "distance < 1000",:joins=>"INNER JOIN ads_places ON places.id=ads_places.place_id INNER JOIN ads ON ads.id=ads_places.ad_id",:order=>'distance ASC')
Please Help me !
Thanks
