User7354632781
User7354632781

Reputation: 2264

undefined method 'paginate'

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>

Upvotes: 1

Views: 2195

Answers (1)

Voldy
Voldy

Reputation: 12868

Restart a server after installing a gem.

Upvotes: 3

Related Questions