vendredi 30 septembre 2016

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://ift.tt/2dhPmkK

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>

Aucun commentaire:

Enregistrer un commentaire