how do i resolve this error?
undefined local variable or method `recipe_params' for #<RecipesController:0x00007ffa3c046490> Did you mean? recipe_path
def create
@recipe = Recipe.new(recipe_params)
if @recipe.save
redirect_to root_path
class RecipesController < ApplicationController
def index
end
def new
@recipe = Recipe.new
end
def create
@recipe = Recipe.new(recipe_params)
if @recipe.save
redirect_to root_path
else
render 'new'
end
end
private
def book_params
params.require(:recipe).permit(:title, :description, :rating, :author)
end
end
def index
end
def new
@recipe = Recipe.new
end
def create
@recipe = Recipe.new(recipe_params)
if @recipe.save
redirect_to root_path
else
render 'new'
end
end
private
def book_params
params.require(:recipe).permit(:title, :description, :rating, :author)
end
end
Hey Alan!
Change your "book_params" method at the bottom of the controller to "recipe_params" and you should be good. Looks like just a copy-paste typo you missed. 🤓
Change your "book_params" method at the bottom of the controller to "recipe_params" and you should be good. Looks like just a copy-paste typo you missed. 🤓