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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:21:34+00:00 2026-05-25T18:21:34+00:00

this form_for used to work before I ported my application to rails 3.1 <div

  • 0

this form_for used to work before I ported my application to rails 3.1

<div class="form-box" style="padding-left:1em;">
  <%
     action = @existing_mass.nil? ? "add_to_power_plant": "update_power_plant_substrate";
     submit_button_label = @existing_mass.nil? ? 'Add': 'Update';
  %>

  <%= form_for :substrate_mass, @substrate_mass, :remote => true, :url => { :action => action, :substrate_id => @substrate_mass.substrate  } do |f| %>
    <div>
      <%= f.label :quantity_per_year, "Quantity" %>
      <%= f.text_field :quantity_per_year, :size => 5, :onclick => 'this.select();', :value => @substrate_mass.quantity_per_year %>
    </div>

    <div class="actions" style="float:right;">
      <%= f.submit submit_button_label %>
    </div>
    <br/> 
  <% end %>
</div>

I have spent over 4 hours trying to figure out what’s wrong … there is definitely something I am not understanding anymore

I get the error:

wrong number of arguments (3 for 2)

Note that I am trying to update an variable that is not an activerecord object. It’s just an object that is not stored in the database.

Hope someone can help.

cheers

  • 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-25T18:21:35+00:00Added an answer on May 25, 2026 at 6:21 pm

    form_for only takes two arguments, the record, and options, although record may be several things, including a simple symbol, an object, or an array.

    Try just dropping the first symbol and sending your object. If you model does not include ActiveModel::Naming, you may set the name via the :as option.

    <%= form_for @substrate_mass, :as => 'substrate_mass', ... %>
    

    More help may be found here:
    http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_for

    Or to view the source directly:
    https://github.com/rails/rails/blob/v3.1.0/actionpack/lib/action_view/helpers/form_helper.rb#L353

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

Sidebar

Related Questions

In our application, we use document.forms[0] to access the form from JavaScript. This used
I need to save a user's login information in encrypted form for this application
I am creating a select box for a form using this in _form.html.erb <%=
I used a form generator to create a simple for me to work with.
I have used this site before with great success and I am having a
I've used BackgroundWorkers quite a bit, but I've never experienced this problem before. My
I have a function that used to work before I changed the names of
BEFORE CHAOS I used to have this one... at the head part <script type=text/javascript>$(function()
I've used the code in this article before to create a custom validator to
I have this form for inputting the birthday in html. But I only have

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.