我尝试在我的对象日历中搜索某些内容,但是当我点击提交时,我一直都会收到此错误。 我真的不明白为什么?
请求方法POST不适合网址/。
_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 %>
calendar_controller
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
route.rb
resources :users do
resources :calendars
end
答案 0 :(得分: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 %>