<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mah666hhh</author_name>
  <author_url>https://blog.hatena.ne.jp/mah666hhh/</author_url>
  <blog_title>スリ飯屋MaLankaのフリーエンジニアな日々</blog_title>
  <blog_url>https://www.malanka.org/</blog_url>
  <categories>
    <anon>技術関連</anon>
    <anon>技術関連 - Rails</anon>
    <anon>技術関連 - ActiveAdmin</anon>
  </categories>
  <description>permit_paramsに、 子モデルの「名称」と「属性」を指定すればOKです。 例えば、 下記のようなモデルがあるとします。 # 親 class Plan attribute :name attribute :price has_many :contracts end # 子 class Contract belongs_to :plan end この場合、 ActiveAdmin側で下記のようにすればOKです。 # app/admin/contract.rb ActiveAdmin.register Contract do # これを追加 permit_params plan: [:name, :price] # コントローラー的な処理をしたい場合に追加 controller do end end ここで注意点。 permit_paramsには、 親モデル名だけではなく、 親モデルの属性まで書いてあげる必要があります。</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.malanka.org%2Fentry%2FSpecify-strong_parameter-of-belongs_to-model-in_ActiveAdmin-form&quot; title=&quot;【ActiveAdmin】formで、belongs_toなmodelのstrong_parameterを指定する - スリ飯屋MaLankaのフリーエンジニアな日々&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/m/mah666hhh/20201107/20201107160400.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-11-07 16:05:26</published>
  <title>【ActiveAdmin】formで、belongs_toなmodelのstrong_parameterを指定する</title>
  <type>rich</type>
  <url>https://www.malanka.org/entry/Specify-strong_parameter-of-belongs_to-model-in_ActiveAdmin-form</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
