2011-07-05 9 views
0

私は最近、Rails 2用に書いたコードを使用して新しいrails 3アプリケーションを作成し、同時に新しいAPIに合わせてアップグレードしました。rails 3未定義のメソッド `_index_path 'をform_forを使用する場合

I次のコードを持っている:

#routes.rb: 
FtpMgmt::Application.routes.draw do 
    resources :accounts 
    root :to => "accounts#index" 
    match ':controller(/:action(/:id(.:format)))' 
end 

#new.html.erb 
<% form_for(@account) do |f| %> 
... 
<% end %> 

#accounts_controller.rb 
class AccountsController < ApplicationController 
    respond_to :html, :xml, :json 
    def new 
     @account = Accounts.new 
     respond_with(@account) 
    end 
end 

私が手にエラーがある:

Showing /opt/rails/ftp_mgmt/app/views/accounts/new.html.erb where line #3 raised: 
undefined method `accounts_index_path' for #<#<Class:0x0000000a28a758>:0x0000000a269b70> 

あなたが任意のアイデア私はこれをどのように修正することができますを持っていますか?

答えて

1
@account = Accounts.new 

また

@account = Account.new 

でなければなりません

<% form_for(@account) do |f| %> 

はする必要があります

<%= form_for(@account) do |f| %> 
関連する問題