0

我尝试在我的对象日历中搜索某些内容,但是当我单击提交时,我一直收到此错误。我真的不明白为什么?

请求方法 POST 不适用于 URL /。

_search.html.erb

<%= form_for user_calendars_path([@user, @calendar]), :method => 'get'  do %>
    <%= text_field_tag :search, params[:search_condition], :id => 'search_field' %>
      <%= submit_tag "Search" %> 
     <p>hello </p>
<% end %> 

日历控制器

 def index
    @search = @user.calendar.search(params[:search_condition])
    @content_calendars = @user.calendar.all
    @content_calendars_by_dates = @content_calendars.group_by(&:published_on)
    @date = params[:date] ? Date.parse(params[:date]) : Date.today
  end

路由.rb

resources :users do
resources :calendars
end
4

1 回答 1

0

尝试这个:

<%= form_tag user_calendars_path(@user, @calendar), :method => 'get'  do %>
    <%= text_field_tag :search, params[:search_condition], :id => 'search_field' %>
    <%= submit_tag "Search" %> 
    <p>hello </p>
<% end %> 
于 2013-10-26T04:44:59.100 回答