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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:33:12+00:00 2026-05-27T12:33:12+00:00

For my form I am using my Product model: class Product < ActiveRecord::Base attr_accessible

  • 0

For my form I am using my Product model:

class Product < ActiveRecord::Base
  attr_accessible :purchase_date, :send_to_data
end

On my form I have the :purchase_date working correctly when I create multiple products but also want to make the radio_button_tag do the same:

<%= form_tag create_multiple_products_path, :method => :post do %>

  <%= date_select("product", "purchase_date")  %>

   <%= radio_button_tag(:send_to_data, 1) %>
   <%= radio_button_tag(:send_to_data, 0) %>


  <% @products.each_with_index do |product, index| %>
     <%= fields_for "products[#{index}]", product do |up| %>
        <%= render "fields", :f => up %>
     <% end %>
  <% end %>

  <%= submit_tag "Done" %>
<% end %>

This didn’t work for me, my database doesn’t flag as either false or true.

I think the problem lies in the params of the "send_to_data". Unlike the "purchase_date" it isn’t finding the object (product).

{"product"=>{"purchase_date(2i)"=>"12", "purchase_date(3i)"=>"11", "purchase_date(1i)"=>"2011"},
"send_to_data"=>"1", 
"products"=>{"0"=>{"product_name"=>"Test", "price"=>"23", "product_store"=>"13", "exact_url"=>""},
"1"=>{"product_name"=>"", "price"=>"", "product_store"=>"", "exact_url"=>""},
"2"=>{"product_name"=>"", "price"=>"", "product_store"=>"", "exact_url"=>""},
"3"=>{"product_name"=>"", "price"=>"", "product_store"=>"", "exact_url"=>""},
"4"=>{"product_name"=>"", "price"=>"", "product_store"=>"", "exact_url"=>""}}, "commit"=>"Done"}

Is there a way to map it to the object like the purchase date does?

  • 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-27T12:33:12+00:00Added an answer on May 27, 2026 at 12:33 pm

    As far as I can see you confuse FormHelper and FormTagHelper.
    You use Form tag helper which, according to the documentation

    (FormTagHelper) provides a number of methods for creating form tags that doesn’t rely
    on an Active Record object assigned to the template like FormHelper does.

    This mean for ActiveRecord-based form you need to use use FormHelper (and its radio_button helper method).

    Code with radio_button_tag form tag helper

    <%= radio_button_tag(:send_to_data, 1) %>
    <%= radio_button_tag(:send_to_data, 0) %>
    

    generates the following HTML:

    <input id="send_to_data_1" name="send_to_data" type="radio" value="1" />
    <input id="send_to_data_0" name="send_to_data" type="radio" value="0" />
    

    And code with radio_button form helper

    <%= radio_button("product", :send_to_data, 1) %>
    <%= radio_button("product", :send_to_data, 0) %>
    

    generates:

     <input id="product_send_to_data_1" name="product[send_to_data]" type="radio" value="1" />
     <input id="product_send_to_data_0" name="product[send_to_data]" type="radio" value="0" />   
    

    Hope this helps!

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

Sidebar

Related Questions

About to create a form using Zend Form, all the form elements should have
Say you create a form using ASP.NET MVC that has a dynamic number of
I have written a form using the jQuery .post() function to post the data
I created a form using Swing in Java. In the form I have used
I have a Django form using textareas and TinyMCE for text entry. I would
Here is my controller code and also my View: @using (Html.BeginForm(Create, Product, FormMethod.Post, new
Let's assume that I have following models: class ScoutBook(models.Model): troop = models.ForeignKey('Dictionary', limit_choices_to={'type' :
I want to create a simple form for adding new products using jqModal .
I have a view model that show a product.. but the price is in
I have model Product with fields price_cents and price_currency. Money default currency is USD.

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.