我正在寻找一种方法来管理表单中的多个嵌入对象。
找到了 bowsersenior 的 formtastic 解决方案
但我无法为 simple_form 做同样的事情
形式:
= semantic_form_for @team do |form|
= @team.players.each do |player|
= form.inputs :for => [:players, player] do |player_form|
= player_form.input :name
此致
样本
class Team
include Mongoid::Document
field :name, :type => String
embeds_many :players
end
class Player
include Mongoid::Document
embedded_in :team, :inverse_of => :players
field :name, :type => String
field :active, :type=> Boolean # checkboxes
end