This is probably something very simple but I can’t seem to figure out
why I keep getting the ‘wrong number of arguments (1 for 2)’ error with
the following code when I try to create a new record. If anyone can see
what is going wrong here please help!
new.rhtml
…
<%= start_form_tag :action => ‘new’ %>
<%= render :partial => ‘form’ %>
<%= image_submit_tag ‘disk.gif’ %>
<%= end_form_tag %>
…
_form.rhtml
…
<%= text_field ‘inventory’, ‘quantity’ %>
…
inventories_controller.rb
class InventoriesController < ApplicationController
…
def new
case request.method
when :get
@inventory = Inventory.new
logger.debug @inventory.inspect
when :post
@inventory = Inventory.new(params[:inventory])
if @inventory.save
flash[:notice] = ‘Inventory was successfully created’
render :action => ‘list’
else
render :action => ‘new’
end
end
end
…
end
development.log
Processing InventoriesController#new (for 216.110.65.241 at 2006-04-18
17:11:10) [GET]
Parameters: {“action”=>“new”, “controller”=>“inventories”}
Inventory Columns (0.000387) SHOW FIELDS FROM inventories
#<Inventory:0xb793a0e0 @new_record=true, @attributes={“created_on”=>nil,
“status”=>0, “part_id”=>0, “account_id”=>0, “branch_id”=>0,
“updated_on”=>nil, “created_by”=>nil, “quantity”=>1, “updated_by”=>nil}>
Rendering within layouts/application
Rendering inventories/new
ActionView::TemplateError (wrong number of arguments (1 for 2)) on line
#1 of app/views/inventories/_form.rhtml:
1: <%= text_field ‘inventory’, ‘quantity’ %>
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/helpers/form_helper.rb:253:in
send' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/helpers/form_helper.rb:253:in
value_before_type_cast’
/usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/helpers/form_helper.rb:168:in
to_input_field_tag' /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_view/helpers/form_helper.rb:76:in
text_field’
#{RAILS_ROOT}/app/views/inventories/_form.rhtml:1