undefined methods page_count

I'm getting "undefined method `page_count' for #<Array:0xb7073e1c>" when I tried to run my rails application after installing will_paginate. Details are as below:

undefined method `page_count' for #<Array:0xb7073e1c>

Extracted source (around line #7):

4: <%= a.text%> 5: <% end %> 6: 7: <%= will_paginate @announcements, :inner_window => 10, :outer_window => 10 %> 8: 9: <p> 10: <%= link_to_protected 'Main page', :action => 'index' %>

RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace

/home/jerry/NetBeansProjects/hacdb/vendor/plugins/will_paginate/lib/ will_paginate/view_helpers.rb:45:in `will_paginate' /home/jerry/NetBeansProjects/hacdb/app/views/main/list_all_ann.rhtml: 7:in `_run_rhtml_47app47views47main47list_all_ann46rhtml'

/home/jerry/NetBeansProjects/hacdb/vendor/plugins/will_paginate/lib/ will_paginate/view_helpers.rb:45:in `will_paginate' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:325:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:325:in `compile_and_render_template' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:301:in `render_template' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:260:in `render_file' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:812:in `render_file' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:717:in `render_with_no_layout' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/layout.rb:247:in `render_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:50:in `render' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:50:in `render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:1102:in `perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/filters.rb:696:in `call_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/filters.rb:688:in `perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/rescue.rb:83:in `perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:435:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:435:in `process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/filters.rb:684:in `process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/session_management.rb:114:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:334:in `process' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:41:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/rails.rb: 76:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/rails.rb: 74:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/rails.rb: 74:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:155:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:154:in `each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:154:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/ configurator.rb:282:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/ configurator.rb:281:in `each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/ configurator.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails: 128:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/command.rb: 212:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails:281 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:342:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/servers/ mongrel.rb:60 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:495:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:342:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:495:in `require' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/server.rb: 39 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' script/server:3

/home/jerry/NetBeansProjects/hacdb/vendor/plugins/will_paginate/lib/ will_paginate/view_helpers.rb:45:in `will_paginate' /home/jerry/NetBeansProjects/hacdb/app/views/main/list_all_ann.rhtml: 7:in `_run_rhtml_47app47views47main47list_all_ann46rhtml' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:325:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:325:in `compile_and_render_template' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:301:in `render_template' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_view/ base.rb:260:in `render_file' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:812:in `render_file' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:717:in `render_with_no_layout' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/layout.rb:247:in `render_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:50:in `render' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:50:in `render' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:1102:in `perform_action_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/filters.rb:696:in `call_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/filters.rb:688:in `perform_action_without_benchmark' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/benchmarking.rb:66:in `perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/rescue.rb:83:in `perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:435:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:435:in `process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/filters.rb:684:in `process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/session_management.rb:114:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/ action_controller/base.rb:334:in `process' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:41:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/rails.rb: 76:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/rails.rb: 74:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/rails.rb: 74:in `process' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:155:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:154:in `each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:154:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel.rb:264:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/ configurator.rb:282:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/ configurator.rb:281:in `each' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/ configurator.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails: 128:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/lib/mongrel/command.rb: 212:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.1/bin/mongrel_rails:281 /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:342:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:488:in `load' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/servers/ mongrel.rb:60 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:495:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:342:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/ active_support/dependencies.rb:495:in `require' /usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/commands/server.rb: 39 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' script/server:3

I'm new to rails. Pleas help.

I'm having the same problem... I already know what is the problem but I don't know how to solve it because I'm calling the pagination on one model (where I'm searching for something) but I'm showing results of another model that are linked to the first one.

                specs = Spec.paginate (:all, :page => params[:page], :per_page => 10,                                    :conditions => ["last_name LIKE ?", @initial+"%"],                                   :order => "last_name, first_name")           @users = specs.collect { |spec| spec.user }

<% if @users and not @users.empty? %>   <table class="users" border="0" cellpadding="5" cellspacing="1">         <tr class="header">           <th>Name</th> <th>Age</th> <th>Gender</th> <th>Location</th>       </tr>     <% @users.each do |user| %>       <tr class="<%= cycle('odd', 'even') %>">         <td><%= link_to user.name, profile_for(user) %></td>         <td><%= user.spec.age %></td>         <td><%= user.spec.gender %></td>         <td><%= user.spec.location %></td>       </tr>     <% end %>   <% will_paginate @users %>   </table> <% end %>

It's returning page_count undefined which I can understand but how do I paginate my @users array?

Thanks, Thiago Guerra