2

I get this error when i did pagination (will_paginate) + rails 4. really dont understand what went wrong

gem file

gem 'will_paginate', '~> 3.0'

here is the controller

@users = User.where.not(:name => "admin").all
@user_paginate = @users.paginate(:page => params[:page], :per_page => 3)

view

<%= will_paginate @user_paginate %>

application controller i did

require 'will_paginate/array'

model relations

User has_many :listings

Listing belongs_to :user

any help will be appreciated thanks

aliyan
  • 71
  • 1
  • 5

2 Answers2

5

found the solution

change gem 'will_paginate', '~> 3.0'

to

gem 'will_paginate', '~> 3.0.5'

and this worked for me

aliyan
  • 71
  • 1
  • 5
0

try this @users = User.where.not(:name => "admin").all.paginate(:page => params[:page], :per_page => 3) and see if you get the same error. or (name: 'admin')

why do you have the require 'will_paginate/array' thats for something like this array.paginate(:page => a, :per_page => b)

Check this post

Community
  • 1
  • 1
Frank004
  • 228
  • 1
  • 2
  • 16