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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:04:57+00:00 2026-05-23T03:04:57+00:00

I have this form: <%= form_for(@debate.debates.build) do |support_form| %> <div> <%= support_form.label :content %><br

  • 0

I have this form:

<%= form_for(@debate.debates.build) do |support_form| %>  
  <div>
    <%= support_form.label :content %><br />
    <%= support_form.text_area :content %>
  </div>
  <%= support_form.hidden_field :is_supporting, :value => is_supporting %>
  <div class="actions">
    <%= support_form.submit %>
  </div>
<% end %>

Each debate has_many debate and belongs to a debate (a tree structure) and @debate.debates.build is supposed to create a new debate that is the child of @debate, but the debate created by @debate.debates.build is always nil

When I run the same code in irb, though, the association is correctly set up, and the debate id of the new debate is its parent, the way I want it to be.

Whats going on? And how can I make sure that the new debate has its parent debates id set up correctly?

  • 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-23T03:04:57+00:00Added an answer on May 23, 2026 at 3:04 am

    It builds it in memory, but I don’t think it actually saves it until a save is run, presumably in the recipient action of the form, probably the create action of the controller.

    In order for that to work, the debate id (debate_id? you don’t show enough of your model) may need to be in the form as well.

    Finally, the issue could be related to attr_accessible or attr_protected issues. If the debate id is not allowed to be set as part of the bulk attribute update, it may get lost in the submission.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this input in a form: <input type=text value=<script src='/js/script.js' type='text/javascript'></script> name=embed/> The
I have this form: <tr> <td><input type=hidden name=ledlamps value=LED lamps>LED lamps:</td> <td><input class=field checkbox
I have this link that creates a few div's in which a form is
I have this div, where divBrdr should contain a form summaryConfig <div id=popup> <div
In my views.py, i have a snippit of code like this: def clean_post_data(form): for
I have a table for a contact form and this table contains another table
I have this form in my view: <!-- Bug (extra 'i') right here-----------v -->
I have this form: <form name=customize> Only show results within <select name=distance id=slct_distance> <option>25</option>
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I have data in this form, Article ID Company A Company B Company C

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.