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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:01:39+00:00 2026-05-25T21:01:39+00:00

This is my form: <table> <tbody> <% form_for :HhActiveCarrier, @carriers, :url => { :action

  • 0

This is my form:

<table>
  <tbody>
  <% form_for :HhActiveCarrier, @carriers, :url => { :action => "update" } do |f| %>
  <% for carrier in @carriers %>
    <tr>
      <%= render :partial => "summary_detail", :locals => {:carrier => carrier, :f => f} %>
    </tr>
  <% end %>
  </tbody>
</table>
  <%= submit_tag "Update" %>
  <% end %>

With my partial:

<td class="tn"><%= h(carrier.name.to_s()) -%></td>
<td class="sc"><%= h(carrier.country.to_s()) -%></td>
<td class="sc"><%= select(:carrier, "country", @countries) -%></td>

This is the controller where I define the variables:

class ActiveCarriersController < ApplicationController

    def index
        @carriers = HhActiveCarrier.find(:all)
        for carrier in @carriers
            country = carrier["country"]
            if country.nil?
                carrier["country"] = "none"
            end
        end
        @countries = ["USA", "UK", "Canada"]
    end

    def update
        carriers = HhActiveCarrier.find(:all)
        for carrier in carriers
            carrier.update_attributes(params[:country])
        end
        redirect_to( :action => "index" )
    end

What I want to happen is after I click the “Update” button, I want the new country selected from the drop down list to be put into the HHActiveCarrier model. With the code I have right now, I get this error:

OCIError: ORA-00904: “ID”: invalid identifier: UPDATE
hh_active_carriers SET name = ‘AT&T’, country = null WHERE id = null

How would I go about updating the attributes this? I am using ruby on rails 2.3.8.

Edit:
Added parameters hash from development log:

parameters: {“commit”=>”Update”, “carrier”=>{“country”=>”USA”},
“action”=>”update”, “controller”=>”active_carriers”}

content_type: #

accepts: [#, #, #]

raw_post:
“carrier%5Bcountry%5D=USA&carrier%5Bcountry%5D=USA&carrier%5Bcountry%5D=USA&carrier%5Bcountry%5D=USA&commit=Update”

query_parameters: {}

request_parameters: {“commit”=>”Update”, “action”=>”update”,
“carrier”=>{“country”=>”USA”}, “controller”=>”active_carriers”}

Edit3:

Form:

<table>
  <tbody>
  <% form_for :HhActiveCarrier, :url => { :action => "update" } do |f| %>
  <% for carrier in @carriers %>
    <tr>
      <%= render :partial => "layouts/summary_detail", :locals => {:carrier => carrier, :f => f} %>
    </tr>
  <% end %>
  </tbody>
</table>
<%= submit_tag "Update" %>
<% end %>

Partial:

<td class="tn"><%= h(carrier.name.to_s()) %></td>
<td class="sc"><%= h(carrier.id.to_s()) %></td>
<td class="sc"><%= h(carrier.country.to_s()) %></td>
<td class="sc"><%= f.collection_select :country, HhActiveCarrier::COUNTRIES, :to_s, :to_s %></td>

Controller:

class ActiveCarriersController < ApplicationController

    def index
        @carriers = HhActiveCarrier.find(:all)
        for carrier in @carriers
            country = carrier["country"]
            if country.nil?
                carrier["country"] = "none"
            end
        end

    end


    def update
        #update code
        redirect_to( :action => "index" )
    end
end
  • 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-25T21:01:39+00:00Added an answer on May 25, 2026 at 9:01 pm

    A few things:

    1. Adjust your form so it uses the fields_for helper for each of the carriers (scroll down almost 1/2 way, for the code snippet that’s labeled “Or a collection to be used:”)
    2. Add a hidden field in your partial that indicates the ID of the carrier being updated (right now, your params hash doesn’t include the ID of the record to be updated, so the update fails)
    3. Don’t loop through all carriers in your controller. You want to loop through the hash instead.

    So, the hash you want from the form should look something like:

    params => {:carrier[1] => {:country => "USA", :id=>"5"}, carrier[2] => {:country => "Brazil", :id=>"17"}}
    

    Then in your controller, you would loop through params[:carrier].each to update your carriers.

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

Sidebar

Related Questions

I have this form: <form method=post action=mypage.php orderform= name= id=orderform> <a id=add>+</a> <table width=533
This is my spring form code in jsp. <div id=mainDiv> <div id=itWillRepeat> <table> <tbody>
<form action= method=post id=SaveIndicationsExportForm> <table cellspacing=0 cellpadding=0 id=hover style=float: left;> <tbody> <tr> <td class=hoverButtonLeft
How can I ensure that this does NOT open in a new window?? onclick=ob=this.form.table;window.open(ob.options[ob.selectedIndex].value)/>
I have a table for a contact form and this table contains another table
I'm trying to select an element given by: /html/body[@id='someid']/form[@id='formid']/div[@id='someid2']/div[@id='']/div[@id='']/div[@id='']/table/tbody[@id='tableid']/tr[7]/td[2] Now the html of that
var SortingTable = new Class({ initialize: function( table, options ) { this.table=$(table); this.tbody =
When I add to table using jQuery $('#myTable > tbody:last').prepend('<tr><td>test</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>'); The form wrapped by
I need to get content from a site I need to get /html/body/div/div[2]/table/tbody/tr/td/div/div[2]/form/fieldset[2]/table[2] or
Jquery UI Dialog modal-form doesn't shows up inside table, but works fine outside. This

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.