title: Active Admin: Form with datepicker on custom page
body: <p>Alright I made a custom page in Active Admin called "Newest Rooms" and it shows a table with the Hotel Rooms of the current date.</p>
  
  <p>Now I want to add a form the this custom page where I can pick the Date. I've managed to make the form appear with the Datepicker through:</p>
  
  <pre><code>&lt;%= semantic_form_for :newest_rooms, :builder =&gt; ActiveAdmin::FormBuilder do |f|
     f.inputs do
       f.input :Datum, :as =&gt; :datepicker
     end
     f.buttons
  end %&gt;
  </code></pre>
  
  <p>But no idea how to send this to the right controller and to the method HotelRoom.newest_rooms</p>
  
  <p>I hope someone can explain to me how to do this. I've added the code below:</p>
  
  <p>newest_room.rb</p>
  
  <pre><code>ActiveAdmin.register_page "Newest Rooms" do
  
    menu :label =&gt; "Newest Rooms"
  
  
    content do
        render "newest_rooms"
    end
  end
  </code></pre>
  
  <p>_newest_room.html.erb</p>
  
  <pre><code>&lt;% @cities = Hotel.cities %&gt;
  
  &lt;%= semantic_form_for :newest_rooms, :builder =&gt; ActiveAdmin::FormBuilder do |f|
     f.inputs do
       f.input :Datum, :as =&gt; :datepicker
     end
     f.buttons
  end %&gt;
  
  &lt;ul class="room_list"&gt;
  &lt;% @cities.each do |c| %&gt;
  &lt;li&gt;
      &lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;h2&gt;&lt;%= c.City %&gt;&lt;/h2&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="room_column"&gt;
          &lt;td&gt;Hotel&lt;/td&gt;
          &lt;td&gt;Free Rooms&lt;/td&gt;
          &lt;td&gt;BN-Price&lt;/td&gt;
          &lt;td&gt;Old Price&lt;/td&gt;
      &lt;/tr&gt;
      &lt;% @rooms = HotelRoom.newest_rooms(c.City) %&gt;
      &lt;% @rooms.each do |r| %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= r.hotel.Hotelname %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= r.FreeRooms %&gt;&lt;/td&gt;
          &lt;td&gt;&lt;b&gt;&lt;%= r.Price %&gt;€&lt;/b&gt;&lt;/td&gt;
          &lt;td&gt;&lt;%= r.OldPrice %&gt;€&lt;/td&gt;
      &lt;/tr&gt;   
      &lt;%end%&gt;
  
  &lt;/table&gt;
  &lt;/li&gt;
  &lt;% end %&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>hotel_room.rb</p>
  
  <pre><code>class HotelRoom &lt; ActiveRecord::Base
    validates :title, :presence =&gt; true
    self.table_name = "hotel_room"
  
    belongs_to :hotel, :foreign_key =&gt; 'H_ID'
    accepts_nested_attributes_for :hotel 
  
  
    def to_key
      [self.ID]
    end
  
  
    def self.newest_rooms(city)
  
        HotelRoom.find(:all, :joins =&gt; :hotel, :conditions =&gt; ["hotel.City = ? and hotel_room.Date = ?", city, Date.today])
  
    end
  
  end
  </code></pre>