I have an action ‘approval’ that renders a view which displays some content from a Model (class). Within the view I have a link_to that calls accept with a URL parameter (:id). After the accept action completes (sets approve to true) I would like to render approval again with a message (“Saved!”). However, unlike a static login page, the approval action requires a param the first time it is called. The second time it is rendered, an runtime error occurs (obviously). What is the best way to call approval with the flash notice?
def approval
@c = Class.find(params[:id])
end
def accept
@c = Class.find(params[:id])
@c.approve = true
@c.save
render 'approval', :notice => "Saved!"
end
change this
render 'approval', :notice => "Saved!"to