1

I am trying to use will_paginate gem but getting this error in title. I checked the thread below and did the changes but no luck

http://stackoverflow.com/questions/17105715/undefined-method-paginate

This is what i have

App/Controllers/books_controller.rb

class BooksController < ApplicationController
    def index
    #@books = Book.all
    @books = Book.paginate :page => params[:page], :per_page => 10
    end
end

index.html.erb:

<%= will_paginate @books %>

GemFile

gem 'will_paginate', '~> 3.0.4'

Enbironment.rb

gem 'will_paginate'

and this is the error i get:

undefined method `paginate' for #<Class:0x007fd539118a30>
User7354632781
  • 2,174
  • 9
  • 31
  • 54

1 Answers1

3

Restart a server after installing a gem.

Voldy
  • 12,829
  • 8
  • 51
  • 67