Closed KieranLafferty closed 12 years ago
I have a db with the following set up:
Venue has_one location
Location contains latitude, longitude variables. I want to be able to set my Venue model to acts_as_gmappable and display them on the map as markers. I have tried setting the following :
belongs_to :location
acts_as_gmappable :lng=> "#{self.location.longitude}", :lng => "#{self.location.latitude}"
def gmaps4rails_address
"#{self.location.street_address}, #{self.location.city}, #{self.location.country}"
end
But get unknown attribute "location" when I try to run. Could you please advise whether this is possible?
Fixed it.. I created methods named 'latitude' and longitude and gmaps used those i.e
def latitude self.location.latitude end
def longitude self.location.longitude end
I have a db with the following set up:
Venue has_one location
Location contains latitude, longitude variables. I want to be able to set my Venue model to acts_as_gmappable and display them on the map as markers. I have tried setting the following :
belongs_to :location
acts_as_gmappable :lng=> "#{self.location.longitude}", :lng => "#{self.location.latitude}"
def gmaps4rails_address
describe how to retrieve the address from your model, if you use directly a db column, you can dry your code, see wiki
end
But get unknown attribute "location" when I try to run. Could you please advise whether this is possible?