0
Ich würde gerne wissen, ob jemand das Problemnicht definierte Methode `TOTAL_PAGES' für # <Rezept :: ActiveRecord_Relation: 0x007fb4045fec58>
sehe ich den Edelstein will_paginate bin mit
Mein Rezept Modell:
class Recipe < ActiveRecord::Base
belongs_to :user
has_many :ingredients, dependent: :destroy
has_many :reviews, dependent: :destroy
self.per_page = 10
end
Mein RecipesController:
class RecipesController < ApplicationController
skip_before_action :authenticate_user!
def index
if params[:search]
@recipes = Recipe.search(params[:search]).page(params[:page]).order("created_at DESC")
else
@recipes = Recipe.all.page(params[:page]).order('created_at DESC')
end
end
def show
@review = Review.new
@recipe = Recipe.find(params[:id])
@user = User.find(@recipe.user_id)
@full_name = @recipe.user.first_name + " " + @recipe.user.last_name
end
end
app/views/Rezepte/index.html.erb:
<%= will_paginate @recipes %>