だから私は次のモデル構造を持っています
class Product < AR
belongs_to :buyable, :polymorphic => true, :inverse_of => :product
end
class Stone < AR
has_one :product, :as => :buyable, :inverse_of => :buyable
accepts_nested_attributes_for :product, :allow_destroy => true
end
およびこの RailsAdmin 構成:
config.included_models = [Product, Stone]
config.model Stone do
edit do
field :product
field :rock
end
end
新しい Stone-Record を作成しているときは機能していますが、Product フィールドが折りたたまれています。しかし、すべての石にはすべての製品フィールドが入力されている必要があるため (モデルに検証があるため)、常に折りたたまれないようにしたいと考えています。構成に追加しようとしvisible
ましたが、うまくいきません...
また、RailsAdmin の Stone リスト ビューに name 属性を表示させたいのですがfield :product
、設定で指定してもうまくいきません... wiki 全体を読んで検索しても、理解できませんでした。マニアックなGoogleで...