# Sorting Helper issue

**URL:** <https://www.ruby-forum.com/t/sorting-helper-issue/135135>\
**Category:** Rails\
**Created:** [April 18, 2008, 9:49am UTC](https://www.ruby-forum.com/t/sorting-helper-issue/135135 "2008-04-18T09:49:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![durgesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@durgesh](https://www.ruby-forum.com/u/durgesh)\
**Post date:** [April 18, 2008, 9:49am UTC](https://www.ruby-forum.com/t/sorting-helper-issue/135135/1 "2008-04-18T09:49:58Z")

</div>

Hi Friends,

```
I am very new to RoR. I have now got the pager working for my

```

listing page and was trying to get the sorting to work. However I get  
this error:

MissingSourceFile in PeopleController#index  
Missing helper file helpers/sorting\_helper.rb  
RAILS\_ROOT: C:/ruby/contact

Application Trace | Framework Trace | Full Trace  
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
helpers.rb:127:in `helper' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ helpers.rb:111:in`each’  
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action\_controller/  
helpers.rb:111:in `helper’  
app/controllers/people\_controller.rb:3

Following is the code in the controller:

def index  
@sorter = SortingHelper::Sorter.new self, %w(name address),  
@params[‘sort’], @params[‘order’], ‘name’, ‘ASC’  
@people = Person.search(params[:search], params[:page])  
end

following is the code in the view:

# Listing people

\<% for person in @people %\>

\<% end %\>

| \<%= link\_to 'Name', @sorter.to\_link('name') %\> | \<%= link\_to 'Address', @sorter.to\_link('address') %\> |
| --- | --- |
| \<%=h person.name %\> | \<%=h person.address %\> | \<%= link\_to 'Show', person %\> | \<%= link\_to 'Edit', edit\_person\_path(person) %\> | \<%= link\_to 'Destroy', person, :confirm =\> 'Are you sure?', :method =\> :delete %\> |

  

\<%= will\_paginate @people %\>

\<%= link\_to ‘New person’, new\_person\_path %\>

following is the code in the model:

class Person \< ActiveRecord::Base

# models/product.rb

def self.search(search, page)  
paginate :per\_page =\> 5, :page =\> page,  
:conditions =\> [‘name like ?’, “%#{search}%”],  
:order =\> ‘name’  
end

end

i also added this line to the routes.rb

map.connect ‘:controller/:action/:sort/:order’

```
Looking forward to your help yet again.....:)

```

* * *

Thanks,  
Durgesh

---

<div class="post-metadata">

**Author:** ![durgesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@durgesh](https://www.ruby-forum.com/u/durgesh)\
**Post date:** [April 18, 2008, 9:51am UTC](https://www.ruby-forum.com/t/sorting-helper-issue/135135/2 "2008-04-18T09:51:09Z")

</div>

guys do i have to download and install any gem for this just like the  
way i did for pagination?

---

<div class="post-metadata">

**Author:** ![durgesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@durgesh](https://www.ruby-forum.com/u/durgesh)\
**Post date:** [April 18, 2008, 10:26am UTC](https://www.ruby-forum.com/t/sorting-helper-issue/135135/3 "2008-04-18T10:26:10Z")

</div>

have you install the plugin?

ruby script/plugin install  
svn://errtheblog.com/svn/plugins/will\_paginate

and dont forget to ensure that you install svn in your OS. Try to ask  
google how to install SVN in your OS.

Reinhart  
[http://teapoci.blogspot.com](http://teapoci.blogspot.com)

---

<div class="post-metadata">

**Author:** ![durgesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb9ed0/32.png) [@durgesh](https://www.ruby-forum.com/u/durgesh)\
**Post date:** [April 18, 2008, 6:12pm UTC](https://www.ruby-forum.com/t/sorting-helper-issue/135135/4 "2008-04-18T18:12:29Z")

</div>

well i would prefer to install a gem rather than do it through the  
plugin…, can anyone please tell me how to do that?

On Apr 18, 2:26 pm, Visit Indonesia 2008 \<rails-mailing-l…@andreas-
