Ruby on rails 3 Rails3表单\标记路由错误

Ruby on rails 3 Rails3表单\标记路由错误,ruby-on-rails-3,Ruby On Rails 3,我在获取视图和控制器时遇到问题,无法很好地配合使用。我想我把路线搞乱了,任何帮助都会很好 我的控制器看起来像: class AccountDetailsController < ApplicationController def new puts "in new" end def home puts "in home" end end resources :account_details <h1>AccountDe

我在获取视图和控制器时遇到问题,无法很好地配合使用。我想我把路线搞乱了,任何帮助都会很好

我的控制器看起来像:

class AccountDetailsController < ApplicationController

    def new
      puts "in new"
    end

    def home
      puts "in home"
    end
end
resources :account_details
<h1>AccountDetails#new</h1>
<%= form_tag(url_for(:controller => "account_details", :action => "new"), :method => "post") do %>
  <%= label_tag(:q, "Search for:") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Submit") %>
<% end %>
My new.html.erb看起来像:

class AccountDetailsController < ApplicationController

    def new
      puts "in new"
    end

    def home
      puts "in home"
    end
end
resources :account_details
<h1>AccountDetails#new</h1>
<%= form_tag(url_for(:controller => "account_details", :action => "new"), :method => "post") do %>
  <%= label_tag(:q, "Search for:") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Submit") %>
<% end %>
当我去 我得到我的页面,当我点击提交时,我得到以下错误:

已在2012年5月2日星期三22:38:10-0400为0:0:0:0:0:0:0:1%0开始发布/帐户详细信息/新建

ActionController::RoutingError没有与之匹配的路由[POST]/account\u details/new:


除了不知所措,我做错了什么?我以为我的路线会包括[张贴],不?

创建新条目的正确方法是放置,而不是张贴。您应该从模板中删除:method=>post,所以将自动选择PUT方法