I am attempting to create an edit action in a controller for a nested resource. When I attempt to run the Edit action, I receive the following Error:
ActiveRecord::RecordNotFound in IngredientsController#edit
Couldn't find Recipe with 'id'=287
Below is my controller:
class IngredientsController < ApplicationController
def edit
@recipe = Recipe.find(params[:id])
@ingredient = @recipe.ingredients.find(params[:id])
end
end
And my link to the Edit:
%= link_to 'Edit Ingredient', edit_recipe_ingredient_path(@recipe, ingredient) %>
Any ideas what may be causing this? Please let me know if any other code is needed to give context to the problem. Thank You!