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 546379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:51:39+00:00 2026-05-13T10:51:39+00:00

OK, so the relationship is: Program has many :events And each Event belongs to

  • 0

OK, so the relationship is: Program has many :events
And each Event belongs to an Organizer (who has_many :events)

In a form for Program/edit, I’d like to list the associated events, and with each of those entries, also have access to each Organizer so I can do something like:

textfield(event.name) | textfield(event.date) | label(event.organizer.name)

So…

<% form_for([:admin, program]) do |f| %>

...

  <h3>Event Data Fields</h3>
    <table>
     <% f.fields_for :events do |event_form| %>
  <tr class="line_item">
    <td><%= event_form.text_field :name %></td>
    <td><%= event_form.text_field :date %></td>
    <td><%= event_form.text_field "organizer.name", :disabled=>true %></td>

  </tr>


      <% end %>
    </table>
    <p><%= f.submit "Submit" %></p>
<% end %>

Obviously, event_form.text_field “organizer.name” won’t work, but that’s the concept

  • 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-13T10:51:39+00:00Added an answer on May 13, 2026 at 10:51 am

    Why not just use fields for?…

    <% form_for([:admin, program]) do |f| %>
    
    ...
    
      <h3>Event Data Fields</h3>
      <table>
         <% program.events.each do |event| %>
           <% f.fields_for event do |event_form| %>
      <tr class="line_item">
        <td><%= event_form.text_field :name %></td>
        <td><%= event_form.text_field :date %></td>
        <% event_form.fields_for(:organizer) do |organizer_form| %>
          <td><%= organizer_form.text_field :name, :disabled=>true %></td>
        <% end %>
      </tr>
           <% end %>
         <% end %>
       </table>
       <p><%= f.submit "Submit" %></p>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data model where a 'Program' has a 1-to-many relationship with 'ToDo's
A many-to-many relationship has to methods to remove items: Delete and Remove. What is
I have a parent (Program) pojo with a many-to-many relationship with their children (Subscriber).
I've got m2m relationship like this: #main table CREATE TABLE products_product ( id integer
In a 1-M relationship, in the many side of the relationship I can pull
I have the following example relationship: namespace Yesod { public class Program { //
I'm writing a program that basically perform server-client relationship. When i run my client
So I am making a program that has a script Set of Steps to
In a C# program, I see the following declarations: public class myForm : Form
I have a many to many relationship in my EF4 model (many groups can

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.