我有一个模型关系: 事件 - >有很多时间表 时间表 - >有一个地址
我想在地址表单中添加一个额外的文本字段,允许用户输入地址并单击“搜索按钮”,以便用户可以选择地理编码器地址。
但是,我似乎无法创建自定义(非模型相关)文本字段或按钮
form do |f|
f.inputs do
f.input :title
f.input :category
f.input :avatar, :as => :file
f.input :description, as: :html_editor
#schedules
f.has_many :schedules do |schedule|
schedule.inputs "Schedules" do
link_to("Auto Fill Address", find_location_path)
#address
schedule.inputs "Address", :for => [:address, schedule.object.address || Address.new] do |address|
address.input :full_address
address.input :city
address.input :country, :include_blank => true
address.input :postcode
address.input :latitude
address.input :longitude
end
#schedule times
schedule.input :start_time, :as => :just_datetime_picker
schedule.input :end_time, :as => :just_datetime_picker
end
end
end
f.buttons
端