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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:50:47+00:00 2026-05-22T22:50:47+00:00

I have 2 models – batch and submision. Batch has_many :submissions Submission belongs_to :batch

  • 0

I have 2 models – batch and submision.

Batch has_many :submissions
Submission belongs_to :batch

My submissions table has a field/column which stores the batch id for each submission,

In my new batch form, user can select submissions via the checkbox and save the form. This will associate the newly created batch id to the selected submissions.

I am currently using the following code to allow user to select submissions and save the form, which in turn will create a new batch and associate the new batch id to the selected submissions.

Code for selecting submissions:

 <% @subs.each do |submission| %>
        <td><%= check_box_tag "batch[submission_ids][]", submission.SUB_ID, @batch.submissions.include?(submission) %></td>
        <td><%= submission.SUB_ID %></td>
        <td><%= submission.SUB_NAME %></td>
    </tr>
  <%end%>

It seems to be working fine, except when editing.

If i create a new batch and associate 2 submissions with it and then i edit that particular batch and deselect ALL submissions and save the batch, the changes are not saved. However if i deselect just one of the submission or select another submission, the changes are saved.

I get this error only when am editing a batch containing selected submissions and am trying to save that batch after deselecting all preselected submissions.

Am really confused about this and thought perhaps the error has something to do with the check_box_tag.

I would be grateful if somebody could provide me with some suggestions concerning this.

Thanks a lot for your help

  • 1 1 Answer
  • 3 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-22T22:50:48+00:00Added an answer on May 22, 2026 at 10:50 pm

    I encountered the same problem once. The thing is that unchecked boxes are not send. From: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-check_box

    “Gotcha
    The HTML specification says unchecked check boxes are not successful, and thus web browsers do not send them. […] “

    Although it’s said that check_box_tag should be ok (http://apidock.com/rails/ActionView/Helpers/FormTagHelper/check_box_tag), I had to pass hidden field_id just in case that all checkbox are unchecked.

    It’s general clue, but I hope it helps. You should check in logs, how and if ids are passed (or deal differently when none are out there).

    Good luck!

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

Sidebar

Related Questions

I have three models: class User include Mongoid::Document field :name, :type => String has_many
I have models Foo and Bar . Bar has column foo_id . When I
I have models foo, bar, and baz like so # has a field join_condition_string
Let us say we have models as such: Trigger belongs_to :position Position has_many :trigger
I have models: Transaction has_many :credits, :debits Credit belongs_to :transaction Debit belongs_to :transaction Each
I have two Models, Programme and Event, a programme has many events. I need
I have an application written using Prism 4.0. It has lots of Views which
I have models: class Materialtitle < ActiveRecord::Base has_many :edocs end class Edoc < ActiveRecord::Base
Let's say I have models that look like this: class Foo < ActiveRecord::Base has_many
I have models A and B. A has_many B. In the edit view for

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.