What does this code actually do?

def update 
  @destination = Destination.find(params[:id]) 
  if @destination.update_attributes(destination_params) 
    redirect_to(:action => 'show', :id => @destination.id) 
    render 'edit' 
  def destination_params
    params.require(:destination).permit(:name, :description)

In the lesson it just tells me to put the code in the controller and doesn't tell me what its doing. Can somebody please explain this to me?


I am also new to this but I will try to explain in my capacity.

The first line uses the .find() to find destinations based on parameter id and the stores it in @destination object.
The destination_params method has code to permit multiple attributes (name and description). It is passed in the .update_attribute() to check whether any changes were made in those attributes. If true then redirect to the show page with that particular id.
Else renders to the edit page