0

I have installed will_paginate and acts_as_ferret on my system for ruby rails.
My paginate seems to work fine before installing acts_as_ferret. When I put in the code to do searching I get the following error:

NoMethodError in Community#search  

Showing app/views/community/_result_summary.rhtml where line #3 raised:  

undefined method `total_entries' for []:Array  

Extracted source (around line #3):  

1: <% if @users %>  
2: <p>  
3: Found <%= pluralize(@users.total_entries, "match") %>.  
4: </p>  
5: <% end %>  

If I take out the search function, paginate works but it's pointless because I can't do searches. Can any one help me out on this one??

Thanks!!

Stephen

skaffman
  • 398,947
  • 96
  • 818
  • 769

1 Answers1

0

undefined method `total_entries' for []:Array

eror itself shows that you are calling total_entries method which is not array method. you get more than one user in your @users. try

1: <% unless @users.blank? %>  
2: <p>  
3: Found <%= pluralize(@users[0].total_entries, "match") %>.  
4: </p>  
5: <% end %>  

EDITED TRY

1: <% unless @users.blank? %>  
2: <p>  
3: Found <%= pluralize(@users.length, "match") %>.  
4: </p>  
5: <% end %>  
Salil
  • 46,566
  • 21
  • 122
  • 156
  • still getting the same error this time on line 3. Ruby is telling me that undefined method 'total_entries' – user328962 Apr 29 '10 at 14:43
  • by the way -- with this code -- the search is blank but the paginate returns an error. – user328962 Apr 29 '10 at 14:47
  • As far as I know, `total_entries` is an array method. It's from `will_paginate`. – Ju Nogueira Apr 29 '10 at 15:54
  • Salil: This was close!! The paginate works -- but the advanced search using ferret now returns blank (nothing). What information can I give you to help me debug this?? I am a total newbie when it comes to RoR!! Thanks for this!!! Stephen – user328962 Apr 29 '10 at 16:27