I have a model that may not have its entries deleted. I wish to have all attempts to delete records raise a notification / error, report this to the user, and return to the original page. In my model file I put this: def destroy errors.add_to_base("Deletion prohibited!") end In the controller I have this: # DELETE /entities/1 # DELETE /entities/1.xml def destroy @entity = Entity.find(params[:id]) respond_to do |format| if @entity.destroy flash[:notice] = ''Entity was destroyed.'' format.html { redirect_to(entities_url) } format.xml { head :ok } else format.html { redirect_to(entities_url) } format.xml { render :xml => @entity.errors, :status => :unprocessable_entity } end end end This seems to work insofar as the records are not deleted. But the error message is not displayed. What am I missing? I know, just get rid of the delete link in the view. Eventually, yes, right now I want to assure myself that no matter how the request comes in the action is disallowed and an error is raised. I will probable want to log the attempt as well. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---