我认为我的表单标签:
<%= form_tag view_all_rater_path, :method => 'get' do %>
<p>
<%= text_field_tag :search, params[:search], :placeholder => 'Search by Set # or date' %></br>
<%= submit_tag "Search", :class => "btn btn-link", :name => nil %>
</p>
<% end %>
我的控制器动作:
def view_all
if params[:search]
@ratings = RatingSet.find(:all, :conditions => ['id = ? or rating_date like ?', "%#{params[:search]}%"])
else
@ratings = RatingSet.all
end
end
我的路线:
resources :rater, :only => [:index] do
collection do
get :rater_csv
get :view_all
end
end
当我导航到 /rater/view_all 时,我得到一个No route matches {:action=>"view_all", :controller=>"rater"}