vendredi 30 septembre 2016

uninitialized constant BooksController::Books

I am creating a sample app and trying to use will_paginate gem.

App/Controllers/books_controller.rb

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

App/views/index.html.erb

<% for book in @books do %>
  <h2><%=h book.title %></h2>
  <p><%= book.thoughts %></p>
  <%= will_paginate @books %>
<% end %>

when i load application i get the error in title. am i missing something?

Aucun commentaire:

Enregistrer un commentaire