class FrogsController < ApplicationController
before_action :find_frog, only: [:edit, :update, :show, :destroy]
after_action :redirect_home, only: [:update, :create, :destroy]
def index
@frogs = Frog.all
end
def new
@ponds = Pond.all
@frog = Frog.new
end
def create
@frog = Frog.create(frog_params)
end
def edit
@ponds = Pond.all
end
def update
@frog.update_attributes(frog_params)
end
def show
end
def destroy
@frog.destroy
end
private
def find_frog
@frog = Frog.find(params[:id])
end
def frog_params
params.require(:frog).permit(:name, :color, :pond_id)
end
def redirect_home
redirect_to frogs_path
end
end
Hi all. I was wondering if someone could explain to me why the update route in rails can't take my after_action of redirecting (custom made method on the bottom) it home. The error that I get when i include update in the after_action is "Missing template frogs/update". This is going to cause me to manually add a redirect_to frogs_path inside the update method.
thanks!