Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8031865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:13:57+00:00 2026-06-05T01:13:57+00:00

Alright I made a custom page in Active Admin called Newest Rooms and it

  • 0

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.

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:

<%= semantic_form_for :newest_rooms, :builder => ActiveAdmin::FormBuilder do |f|
   f.inputs do
     f.input :Datum, :as => :datepicker
   end
   f.buttons
end %>

But no idea how to send this to the right controller and to the method HotelRoom.newest_rooms

I hope someone can explain to me how to do this. I’ve added the code below:

newest_room.rb

ActiveAdmin.register_page "Newest Rooms" do

  menu :label => "Newest Rooms"


  content do
      render "newest_rooms"
  end
end

_newest_room.html.erb

<% @cities = Hotel.cities %>

<%= semantic_form_for :newest_rooms, :builder => ActiveAdmin::FormBuilder do |f|
   f.inputs do
     f.input :Datum, :as => :datepicker
   end
   f.buttons
end %>

<ul class="room_list">
<% @cities.each do |c| %>
<li>
    <table>
    <tr>
        <td>
            <h2><%= c.City %></h2>
        </td>
    </tr>
    <tr class="room_column">
        <td>Hotel</td>
        <td>Free Rooms</td>
        <td>BN-Price</td>
        <td>Old Price</td>
    </tr>
    <% @rooms = HotelRoom.newest_rooms(c.City) %>
    <% @rooms.each do |r| %>
    <tr>
        <td><%= r.hotel.Hotelname %></td>
        <td><%= r.FreeRooms %></td>
        <td><b><%= r.Price %>€</b></td>
        <td><%= r.OldPrice %>€</td>
    </tr>   
    <%end%>

</table>
</li>
<% end %>
</ul>

hotel_room.rb

class HotelRoom < ActiveRecord::Base
  validates :title, :presence => true
  self.table_name = "hotel_room"

  belongs_to :hotel, :foreign_key => 'H_ID'
  accepts_nested_attributes_for :hotel 


  def to_key
    [self.ID]
  end


  def self.newest_rooms(city)

      HotelRoom.find(:all, :joins => :hotel, :conditions => ["hotel.City = ? and hotel_room.Date = ?", city, Date.today])

  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:13:58+00:00Added an answer on June 5, 2026 at 1:13 am

    add an url to your semantic form, like…

    <%= semantic_form_for :newest_rooms, :url => hotel_newest_room_path, :builder => ActiveAdmin::FormBuilder do |f| %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, relevant information can be found in this thread(Is that what they're called here?).
Alright so I have recently made the decision to put every string in my
Alright, I made a program which should work, but unfortunately doesn't. It loads a
Alright so I'm trying to create a method called: setIncrement(). I have two classes
Alright, I'm not sure if this question has been asked before so if it
Alright, this one's interesting. I have a solution, but I don't like it. The
Alright. I am using a Modal box pop up window to display business details
Alright, I hope this isn't too broad a question but my curiosity got the
Alright, I'm having a hard time explaining this, let me know if I should
Alright, I have a UIView which displays a CGPath which is rather wide. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.