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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:32:37+00:00 2026-06-14T02:32:37+00:00

In my app, I have a page where I want admin users to be

  • 0

In my app, I have a page where I want admin users to be able to update a particular characteristic of my “Package” model, which belongs to both the “Order” model and the “Item” model. It’s a little complicated, but I basically want to present in a table all of the Packages belonging to a given Item, ordered in a particular way (that’s what my packages_for_log method below does), with two blanks for updating the weight of the item. All the updates should ideally be submitted at once, with a single submit button at the bottom of the page. I’ve attempted a whole bunch of solutions, and my current one is below, but gives this error when I visit the page in my server:

undefined method `actual_lbs' for #<ActionView::Helpers::FormBuilder:0x007ff67df6c9c8>

The error’s confusing to me, cause I was hoping that I was calling that method on the package instance, not a helper. Bit confused. At any rate, my code is below. The relevant section of the view:

<% form_for(@item) do |a| %>
  <% @item.packages_for_log.each do |p| %>
    <%= a.fields_for p do |i| %>
     <tr>
        <td><%= p.order.name %></td>
        <td><%= p.order.processed_notes %></td>
      <% if p.order.user %>
        <td><%= "#{p.order.user.name.first(3).upcase}-#{p.id}" %></td>
      <% else %>
        <td><%= p.order.id %></td>
      <% end %>
        <td>
          <%= i.text_field :actual_lbs %>
        </td>
        <td>
          <%= i.text_field :actual_oz %>
        </td>
          <%= i.hidden_field :true_weight, value: (i.actual_lbs + i.actual_oz/16) %>
     </tr>
    <% end %>
  <% end %>
<% end %>

Relevant section of the package.rb model file:

 attr_accessible :order_id, :price, :true_weight, :actual_lbs, :actual_oz
 attr_accessor :actual_lbs, :actual_oz  # These two are virtual attributes for the above calc

And I added resources :packages to my routes file.

Any idea what I’m doing wrong? It’s important to me that I loop through to create a table based on “p” and then edit that same “p” object. Just not sure how to do it. Pretty new to Rails.

  • 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-14T02:32:38+00:00Added an answer on June 14, 2026 at 2:32 am

    I think your problem is this line:

    <%= i.hidden_field :true_weight, value: (i.actual_lbs + i.actual_oz/16)
    

    You need to put p.actual_lbs and p.actual_oz

    EDIT: By the way, you probably need to move the true weight calculation to your controller action (CREATE action). I don’t think :true_weight will get passed as you intended it to, using the above method.

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

Sidebar

Related Questions

I'm working on an iphone app and want to have a page showing multiple
I have an ASP.NET MVC app and I want to add to each page
I have Page Tab App, which has a landing page with a Log In
I have a page X in my grails app which has a button to
Background I have a page on my ASP.NET MVC web app for users to
In my WP 7.1 app I have a page with multiple buttons. I noticed
I have a UIWebView in my iPhone app that have a web page with
I have an app with a calendar page. On that page I have elements
I have an app that uses a transition file to flip from page to
I have an app on http://apps.facebook.com/myappname that is a canvas page of http://mydomain.com .

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.