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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:37:47+00:00 2026-06-12T22:37:47+00:00

Here is my form that displays all the feedbacks that was not reviewed yet

  • 0

Here is my form that displays all the feedbacks that was not reviewed yet by admin:

I have 2 radio buttons next to each feedback to select accept or denied with values 1 or 2.

<% form_tag moderate_feedbacks_path, :method => :put do %>
  <table>
    <% @all_feedbacks.each do |feedback| %>
    <tr>
      <td><%= radio_button_tag :review_option, '1', false, :name => feedback.id %></td>
      <td><%= radio_button_tag :review_option, '2', false, :name => feedback.id %></td>
      <td><%= feedback.name %></td>
      <td><%= feedback.email %></td>
      <td><%= feedback.message %></td>
    </tr>
    <% end %>
   </table>
<%= submit_tag 'Apply' %>
<% end -%>

what I want to do is when I click submit_tag, to update the review_option field for each selected feedback with the value of that radio_button_tag, 1 or 2

I have by now the form as you see it, works good, but I am stuck at the controller part:

def moderate_feedbacks
  Feedback.update_all(["review_option = ?", ????])
  redirect_to admin_feedbacks_path
end

how do I pass the params from those radio buttons to the controller.
Thank you.

p.s. html source:

<input id="review_option_1" name="3" type="radio" value="1">
<input id="review_option_2" name="3" type="radio" value="2">

name is taken from feedback.id

logs when I press the submit_tag looks like this;

Processing Admin::FeedbacksController#moderate_feedbacks (for 127.0.0.1 at 2012-10-16 15:36:20) [PUT]
  Parameters: {"commit"=>"Apply", "3"=>"2", "4"=>"1"}

where 3 is the id of feedback – 2 the radio value, 4 is the id of feedback – 1 the radio value

after raise.params["feedback.is"].inspect

Parameters:

    {"commit"=>"Apply",
     "3"=>"1",
     "4"=>"1",
     "_method"=>"put"}
  • 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-12T22:37:48+00:00Added an answer on June 12, 2026 at 10:37 pm

    ok, so here is the answer:

    in the feedback.rb

       class Status
         ACCEPTED = 1
         REJECTED = 2
       end
    

    in the form:

    <% form_tag moderate_feedbacks_path, :method => :put do %>
      <table>
        <% @all_feedbacks.each do |feedback| %>
        <tr>
          <td><%= radio_button_tag :review_option, Feedback::Status::ACCEPTED, false, :name => feedback.id %></td>
          <td><%= radio_button_tag :review_option, Feedback::Status::REJECTED, false, :name => feedback.id %></td>
          <td><%= feedback.name %></td>
          <td><%= feedback.email %></td>
          <td><%= feedback.message %></td>
        </tr>
        <% end %>
       </table>
    <%= submit_tag 'Apply' %>
    <% end -%>
    

    in the feedbacks_controller.rb

       def moderate_feedbacks
        params.each do |key, value|
          if key =~ /^r(\d+)/ && !value.blank?
            feedback_id = $1
            Feedback.update_all(["review_option = ?", value.to_i], ["id = ?", feedback_id])
          end
        end
        redirect_to admin_feedbacks_path
      end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My script is here : jsfiddle i have two attributes in my form that
Here's what I want to do. I have a form that the user fills
I have a page which displays a form that a logged-in user can use
I have a form that loops over the database and displays the form to
Here's my scenario. I call jqModal using its ajax functionality that displays a form
Here’s the situation: We have a 3rd party application that intermittently displays an error
Let's say you have a form with a component that displays data from a
I am trying to emulate another form that the other developer here created. In
Here is something that I find disturbing. I created a small form, and I'm
I know that can co-exists with web form no problem as Hanselman mention here

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.