smanvi12
smanvi12

Reputation: 581

paginate error while using will_paginate gem

I am trying to display all my users and want to paginate them I added these two gems :

gem 'paginate', '~> 4.0', '>= 4.0.1'
gem 'bootstrap-will_paginate', '~> 0.0.10'

The following line gives me an error :

@users = User.paginate(page: params[:page])

I have tried @users = User.all.paginate(page: params[:page]) and @users = User.paginate :all, :page => params[:page]

The error is : You tried to define a scope named "paginate" on the model "ActiveRecord::SchemaMigration", but Active Record already defined a class method with the same name.

any help ?

Upvotes: 0

Views: 213

Answers (1)

niceman
niceman

Reputation: 2673

You're mistaking gems, will_paginate is this and should be added with

gem 'will_paginate'

while you're actually adding this gem with your above statement .

Upvotes: 1

Related Questions