0

I have recently created a new rails 3 application, using the code that I wrote for Rails 2, upgrading it at the same time to match the new API.

I have the following code:

#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

The error I get is:

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

Do you have any ideas how I can fix this?

1 Answer 1

1
@account = Accounts.new

should be

@account = Account.new

Also

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

should be

<%= form_for(@account) do |f| %>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.