**Relevent codes**

routes.rb

```
Waterloop3::Application.routes.draw do
   resources :submissions
   match ':controller(/:action(/:id(.:format)))'
end

```

submission\_controller.rb
- Contains an action called sort\_by\_category\_academic
- Lists all the submissions with a category, academic.

```
class SubmissionsController < ApplicationController
  def sort_by_category_academic
    @submissions = Submission.find(:all, 
    :conditions=>["category = academic" ])
  end
end

```

index.html.erb
- Clicking on a link call "Academic" brings the user to "submissions/sort\_by\_category\_academic"

```
<%= link_to 'Academic', :controller => "submission", :action => "sort_by_category_academic" %>

```

**Some weird behaviours worth noting.**

In routes.rb, move " match ':controller(/:action(/:id(.:format)))' " above " resources :submissions " like below.

```
Waterloop3::Application.routes.draw do
   match ':controller(/:action(/:id(.:format)))' 
   resources :submissions
end

```

When I did this, at least submission was routed to academic perfectly.
However, now the submission page was all acting up. I couldn't put any new entries with this change.
The issue seems to have been with routing priority which I don't quite know about.
If anyone else knows the reason why this fixed the problem, I would love to hear the explanation.
RoR is still quite myserious to me.

**My question**

I thought this would do the job.

```
match ':controller(/:action(/:id(.:format)))'

```

But I keep getting this error when I click on the link, Academic.

**Routing Error**

```
No route matches "/submission/sort_by_category_academic"

```

Any idea how to get around this problem?

---

EDIT

Find action in submissions\_controller.rb

```
  def find
    @submissions = Submission.find(:all, 
    :conditions=>["title = ? OR description = ?", params[:search_string], params[:search_string]])
  end

```

Find text field in index.html.erb

```
<%form_tag "/submissions/find" do%>
<%=text_field_tag :search_string%>
<%=submit_tag "Search"%>
<%end%>

```

So FIND is suppose to take in search\_string and go through all the submissions that match title or description.