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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:06:07+00:00 2026-06-04T21:06:07+00:00

Here is some code that is used basically to show a table of listings

  • 0

Here is some code that is used basically to show a table of listings from my database. Last few columns are nothing but radio buttons and check boxes that are tied to specific boolean attributes of the model. Ive programmed the check boxes and radio buttons. But How do I get them to display the values in the database?

index.html.erb:

<h1>Listings</h1>

<table class="datatable">
 <tr id="heading" >
  <th >id</th>
  <th >name</th>
  <th>telephone</th>
 </tr>

<% @listings.each do |listing| %>
  <tr id="body">
    <th><%=listing.id%></th>
    <th><%= link_to listing.name, edit_listing_path(listing) %></th>
    <th><%=listing.telephone%></th>

 <%= form_for listing do |f| %>     
 <td id="keep"><%= f.radio_button :keep, "Keep" %></br>
    <%= f.label :keep, "Keep" %>
 </td>
 <td id="delete"> <%= f.radio_button :keep, "Delete" %></br>
    <%= f.label :keep, "Delete" %>
 </td>
 <td id="checked"><%= f.check_box :checked %></br>
    <%= f.label :checked, "checked" %>
 </td>
 <td id="collected"><%= f.check_box :collected %></br>
    <%= f.label :collected, "collected" %>
 </td>
 <td id="digitized"><%= f.check_box digitized %></br>
    <%= f.label :digitized, "digitized" %>
 </td>
 <td id="in_db"><%= f.check_box :in_database  %></br>
    <%= f.label :database, "database" %>
 </td>
    <td id="submit"><%= f.submit "update" %></br>

  </td>
  <% end %>
   </tr>
 <% end %> 
 </table>

Also the reason Im choosing the “form” here is because eventually after I figure out how to show the data here, Id like to have this view also “update” the data in the model if the user changes any values in the checkboxes. But, Ill get to that once Ive learnt how to display the model’s values.

Thanks

  • 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-06-04T21:06:08+00:00Added an answer on June 4, 2026 at 9:06 pm

    Something like this:

    <%= f.radio_button :keep, "Keep", :checked => listing.keep %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some code here for printing that prints a block of information from
I'm reading some RAW code from here http://www.zfsnippets.com/snippets/view/id/17/output/raw/table-view-helper where the author is doing a
I've got some code here that works great on IPv4 machines, but on our
I have some code that is using SyncEnumerator. As you can see here ,
So I have some PHP code that looks like: $message = 'Here is the
I've found some code on here that lists all the USB devices on a
Here's some example code: class Obj attr :c, true def == that p '=='
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
Here is some code I modified from this nifty site : http://jsfiddle.net/Ajhka/ I have
I'm trying to build some image algebra code that can work with images (basically

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.