I have two tables (assuming their most logical types):
class Apartment < ActiveRecord::Base has_one :googlemap end class Googlemap < ActiveRecord::Base belongs_to :listing end
I would like to find_all by searching the attributes in apartment, and
also return the google map associated with that apartment, and a null
(or empty string) if there’s no google map in its table associated
with the apartment’s id. In sql I would do this with a left join, and
while I could used the find_by_sql method I was wondering if there’s a
more practical “Rails” way of doing this.
In the apartments controller I have something for found results like
@apartments = Listing.find(:all, :conditions => [“bedrooms=? AND
But that will only return the columns in Apartments. How would I do
that to get the googlemaps url if there is a corresponding value?