私はこのモデルを持っています:
オファー
class Offer < ActiveRecord::Base
has_many :lists
has_many :documents
end
リスト
class List < ActiveRecord::Base
belongs_to :user
belongs_to :offer
has_many :entries, :dependent => :destroy
accepts_nested_attributes_for :entries, :allow_destroy => true
end
エントリ
class Entry < ActiveRecord::Base
belongs_to :list
belongs_to :document
end
ユーザー
class User < ActiveRecord::Base
has_many :lists, :dependent => :destroy
end
私はActiveAdminを使用していますが、変更前はListに次のフォームがありました。
form do |f|
f.inputs "Détails Utilisateurs" do
f.input :user
end
f.inputs "Accès" do
f.has_many :entries, {:title => '', :link => 'Ajouter un document'} do |c|
c.inputs '' do
if not c.object.id.nil?
c.input :_destroy, :as => :boolean, :label => "Supprimer l'accès"
end
c.input :document, :include_blank => false, :collection => offer.documents, :member_label => :to_label
end
end
end
f.buttons
end
しかし、リンクボタンの追加/削除の代わりにチェックボックスを使用したいので、次のようにします:
form do |f|
f.inputs "Détails Utilisateurs" do
f.input :user
end
f.inputs "Accès" do
f.input :entries, :as => :check_boxes, :collection => offer.documents
end
f.buttons
end
しかし、チェックボックスに正しい名前がありません。:name params と :html_options を試しましたが、効果がありません。これを修正するアイデアはありますか?