title: How can I use Active Admin's form block to update a table that tracks when an attribute in a resource is updated?
body: <p>How can I use Active Admin's form block to update a table that tracks when a particular attribute in the current resource is updated?</p>
  
  <p>For instance, I have something like this:</p>
  
  <pre><code>form do |f|
      f.inputs "Details" do
      f.input :name
      f.input :address
      f.input :zip
      f.input :city
      f.input :active_state, as: :select, collection: active_states
      f.input :approval_state, as: :select, collection: approval_states
      f.input :new_comment
    end
    f.buttons
  end
  </code></pre>
  
  <p>where everything but <code>new_comment</code> is an attribute that exists on the current resource.</p>
  
  <p>I tried doing something like this in the class for the resource:</p>
  
  <pre><code>def new_comment
    history = History.new(:id, Time.now)
    history.comment
  end
  </code></pre>
  
  <p>I also tried creating a controller instance variable when that failed, but that didn't work either. The venue class doesn't really have any co-relation to the history class. I'm just trying to create an input column that will create a new row in my History table whenever the user edits a venue and then adds a comment.</p>
  
  <p>The History model looks like this:</p>
  
  <pre><code>class History &lt; ActiveRecord::Base
    attr_accessible :comment, :venue_id, :created_at
    belongs_to :venue
  
    def initialize(id, datetime)
      @id = id
      @datetime = datetime
    end
  end
  </code></pre>
  
  <p>The form is for a Venue that looks like this:</p>
  
  <pre><code>class Venue &lt; ActiveRecord::Base
   attr_accessible :name, :address, :zip, :city
   has_many :histories
   accepts_nested_attributes_for :histories
   //with a bunch of methods
  end
  </code></pre>
  
  <p>I tried doing this after some digging but it didn't work either:</p>
  
  <pre><code>form do |f|
    f.inputs "Details" do
      f.input :name
      f.input :address
      f.input :zip
      f.input :city
      f.input :active_state, as: :select, collection: active_states
      f.input :approval_state, as: :select, collection: approval_states
    end
    f.inputs "History" do
      f.has_many :histories do |h|
          h.input :id
          h.input :comment
          h.input :modified_at
      end
    end
    f.buttons
  end
  </code></pre>