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

  • Home
  • SEARCH
  • 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 1085067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:38:29+00:00 2026-05-16T22:38:29+00:00

Ok guys, so I’m making a scheduler. So I have two tables so far,

  • 0

Ok guys, so I’m making a scheduler.

So I have two tables so far,
Shows with “title:string” and “description:text” and I also have
ShowTime; with “show_id:integer”, “day:string”, and “show_time:time”.

I did the has_many, and belongs_to, I honestly do not know where to go from here on,

I want a user to be able to add the times when creating a new show. What would I do? I was looking at some rails associations documentations, seems like I would be making something like,

@showtime = @shows.showtimes.create(:show_id => show.id, :day => DAY, :show_time => TIME)

Notice I put just DAY and TIME, because I also honestly don’t know how I’ll fetch this data.

  • 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-05-16T22:38:29+00:00Added an answer on May 16, 2026 at 10:38 pm

    It really depends on your interface. But for simplicity, let’s assume you provided two select boxes for selecting day and time, and have to add ShowTime one by one.

    And assume you have rest resources:

    map.resources :shows do |show|
      show.resources :show_times
    end
    

    The form: (given a @show object created already)

    <% form_for @show_time, :url => show_show_time_path(@show) do |form| %>
      <%= form.label :day %>: <%= form.select :day, [["Mon", "mon"], ["Tue", "tue"]], {} %>
      <%= form.label :show_time %>: <%= form.select :show_time, [["Slot 1", "09:00"]], {} %>
    <% end %>
    

    You should provide your best way to generate the day & show_time arrays. They are in the following structure:

    [["Text", "value"], ["Text", "value"]]

    which will generate something like:

    <option value="value">Text</option>

    After the form is submitted, in your create action:

    def create
      @show = Show.find params[:show_id] # this params[:show_id] is from the rest resource's path
      @show_time = @show.show_times.build(params[:show_time]) # this params[:show_time] is from the form you submitted
    
      if @show_time.save
        flash[:notice] = "Success"
        redirect_to show_show_time_path(@show, @show_time)
      else
        flash[:notice] = "Failed"
        render :action => "new"
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys I wrote this code and i have two errors. Invalid rank specifier:
guys. Say I have the following table: ID | String ---+--------- 1 | <123><345>
Ok guys just a small game: I have some specifications for a project. At
Guys i have tried to refresh my page with a button.. <input type=reset value=Refresh
Guys, I have a CSS Layout that I am using that has a header,
Guys, I need some help! I have a fully rendered menu (a safe html
guys. Here's a simple sample two-dimensional array in PL/SQL, which is working perfectly. declare
guys I have StackPanel. I need place there TextBlock with TextAlignment = TextAlignment.Center[Center of
Guys, I have got a slightly different problem with Java Dynamic class loading. I
Guys I have the following structure in my project. application/ Bootstrap.php configs/ application.ini modules/

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.