title: nested form in Activeadmin with dropdown selection - Ruby on Rails
body: <p>I have the next database design:</p>
  
  <p>A <strong>order</strong> can have a <strong>size</strong> and a <strong>size</strong> can be in many <strong>orders</strong>.</p>
  
  <p>For example:</p>
  
  <blockquote>
    <p>Order 1 has a size attribute equal to medium</p>
    
    <p>Order 2 has a size attribute equal to medium</p>
  </blockquote>
  
  <p>I want to be able to select a size when I create a Order in active admin. </p>
  
  <p>Order model:</p>
  
  <pre><code>class Order &lt; ApplicationRecord
    has_one :order_size
    accepts_nested_attributes_for :order_size, :allow_destroy =&gt; true
  end
  </code></pre>
  
  <p>Order size model:</p>
  
  <pre><code>class OrderSize &lt; ApplicationRecord
    belongs_to :orders
  end
  </code></pre>
  
  <p>Also, OrderSize table has to have a order_id column? </p>
  
  <p>I don't know if the models are rights but activeadmin is giving me this error:</p>
  
  <pre><code>undefined method `order_id' for #&lt;Order:0x007fb980e34b80&gt;
  </code></pre>
  
  <p><strong>My activeadmin models</strong></p>
  
  <p>Order Size:</p>
  
  <pre><code>ActiveAdmin.register OrderSize do
    permit_params :name
  end
  </code></pre>
  
  <p>Order:</p>
  
  <pre><code>ActiveAdmin.register Order do
    permit_params :due_date, :comments, :approved, :order_size_id,
                  order_size_attributes: [:id, :name,:_destroy]
  
    form do |f|
      f.inputs "Admin Details" do
        f.input :due_date
        f.input :order_size
        f.input :comments
        f.input :approved
      end
      f.actions
    end
  
  end
  </code></pre>