我正在制作一个使用 gmaps4rails gem 的应用程序,它是一个具有映射功能的简单联系人管理器,所以我有一个名为 person 的主模型
class Person < ActiveRecord::Base
attr_accessible :details, :gmaps, :latitude, :longitude, :address, :name, :contacts_attributes
has_many :contacts
accepts_nested_attributes_for :contacts, allow_destroy: true
acts_as_gmappable
def gmaps4rails_address
address
end
def gmaps4rails_infowindow
"Name: #{name} <br \>
#{details}
//list with symbols of type of contact and contact by itself
#{contacts. ??? }
"
end
我的联系人模型具有三个属性,persons_id、类型(无论是电子邮件、电话、手机)和联系人本身,那么我如何将其传递给 infowindow 内的列表?
这是它如何显示的图像
顺便说一句,我在模型而不是控制器中定义了这一切,因为当时对我来说更容易......
先感谢您