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:


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:insend’
/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:inrender_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:inrender_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:inrender_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:inmeasure’
/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:inperform_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:inperform_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:inmeasure’
/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:inperform_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:inprocess_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:inprocess’
/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:indispatch’
/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:insynchronize’
/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:inprocess_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:inprocess_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:ininitialize’
/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:inrun’
/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:innew’
/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:inrun’
/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:inrun’
/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:inrun’
/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:inload’
/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:inload’
/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:inrequire’
/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:innew_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:ingem_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:incompile_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:inrender_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:inrender_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:inrender’
/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:inrender’
/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:incall_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:inperform_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:inperform_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:insend’
/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:inprocess_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:inprocess’
/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:inprocess’
/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:inprocess’
/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:ineach’
/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:inrun’
/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:innew’
/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:ininitialize’
/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:inrun’
/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:ineach’
/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:inrun’
/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:inload’
/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:innew_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:ingem_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:inrequire’
/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:inrequire’
/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:inrequire’
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? %>

<% @users.each do |user| %> <% end %> <% will_paginate @users %>
Name Age Gender Location
<%= link_to user.name, profile_for(user) %> <%= user.spec.age %> <%= user.spec.gender %> <%= user.spec.location %>
<% end %>

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

Thanks,
Thiago G.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs