내 코드는 매우 간단하지만 오류의 출처를 파악할 수 없습니다. 나는 로컬 호스트에 접속 해요 : 3000/클라이언트/새가 나는 오류를 스택 추적의 wrong number of arguments (3 for 1)
form_for ArgumentError - 인수 개수가 잘못됨 (1 : 3)
최고
ArgumentError - wrong number of arguments (3 for 1):
(gem) actionpack-3.2.12/lib/action_view/helpers/form_helper.rb:378:in `form_for'
(gem) haml-3.1.8/lib/haml/helpers/action_view_mods.rb:183:in `form_for_with_haml'
(gem) haml-3.1.8/lib/haml/helpers/xss_mods.rb:132:in `form_for_with_haml_xss'
app/views/clients/new.html.haml:1:in `_app_views_clients_new_html_haml__386962141__622328728'
/app/controllers/clients_controller.rb
class ClientsController < ApplicationController
def new
@client = Client.new
end
end
있어
/app/models/client.rb
class Client < ActiveRecord::Base
attr_accessible :name
end
/app/views/clients/new.html.haml
= form_for @client, remote: true do |f|
= f.text_field :name
= f.submit
내가 form_for 전에 @client 한 라인을 검사하는 경우,이있어 :
=> #<Client id: nil, name: nil, created_at: nil, updated_at: nil>
어떤 도움을 감사하겠습니다. 감사합니다
코드를 간단하게하기 위해 편집했습니다.
실행중인 루비 버전은 무엇입니까? – dorilla
ruby 1.9.3p327 (2012-11-10 수정 37606) [i686-linux] – Benj