title: Validations with Active Admin
body: <p>I have two models, Event and Image:</p>
  
  <pre><code>class Event &lt; ActiveRecord::Base
    has_many :images
    accepts_nested_attributes_for :images
  
    validates :date, presence: true
    validates :location, presence: true
    validates :name, presence: true
  end
  
  
  class Image &lt; ActiveRecord::Base
    belongs_to :event
  
    mount_uploader :file, AvatarUploader
  
    validates :file, presence: true
    validates :event, presence: true
  end
  </code></pre>
  
  <p>Here are my migrations:</p>
  
  <pre><code>class CreateEvents &lt; ActiveRecord::Migration
    def change
      create_table :events do |t|
        t.date :date
        t.string :location
        t.string :name
  
        t.timestamps
    end
   end
  end
  
  
  class CreateImages &lt; ActiveRecord::Migration
    def change
      create_table :images do |t|
        t.string :file
        t.string :caption
        t.boolean :featured_image
        t.integer :event_id
  
        t.timestamps
    end
   end
  end
  </code></pre>
  
  <p>I am using Carrierwave to upload the Image. I have no problem getting this feature to work when no validations are built in, but I'm trying to prevent an image being uploaded with it's event_id not being assigned.</p>
  
  <p>Currently, my ActiveAdmin file looks like this:</p>
  
  <pre><code>ActiveAdmin.register Event do
    menu label: "Events"
  
    permit_params :date, :location, :name, images_attributes: [:id, :file, :caption, :featured_image, :event_id]
  
    form :html =&gt; { :enctype =&gt; "multipart/form-data" } do |f|
      f.inputs "Event Details" do
        f.input :name
        f.input :location
        f.input :date, :start_year =&gt; 2000, :end_year =&gt; 2020
  
      f.inputs "Images" do
        f.has_many :images, :allow_destroy =&gt; true, :heading =&gt; false, :new_record =&gt; true, :html =&gt; { :multipart =&gt; true } do |p|
          p.input :event_id, :value =&gt; f.object.id
          p.input :file, :as =&gt; :file
          p.input :caption
          p.input :featured_image
        end
       end  
      end
  
    f.actions
  end
  </code></pre>
  
  <p>The main line in question is where I am assigning the event_id to the value of the object's id (the Event).</p>
  
  <p>Is there a way to do this?</p>