[logaling-commit] logaling/logaling-server [enable-creating-user-glossary] Rescue exception

Back to archive index

SUZUKI Miho null+****@clear*****
Thu Sep 20 14:40:51 JST 2012


SUZUKI Miho	2012-09-20 14:40:51 +0900 (Thu, 20 Sep 2012)

  New Revision: eaea70f3b028f4929505a4eb0150727604eb1aa9
  https://github.com/logaling/logaling-server/commit/eaea70f3b028f4929505a4eb0150727604eb1aa9

  Log:
    Rescue exception

  Modified files:
    app/controllers/terms_controller.rb

  Modified: app/controllers/terms_controller.rb (+5 -0)
===================================================================
--- app/controllers/terms_controller.rb    2012-09-20 10:47:51 +0900 (04fb83e)
+++ app/controllers/terms_controller.rb    2012-09-20 14:40:51 +0900 (d7098fd)
@@ -25,12 +25,17 @@ class TermsController < ApplicationController
     new_term = Term.new(params[:term])
     @user_glossary.update(@term, new_term)
     redirect_to user_glossary_path(current_user, @user_glossary), notice: 'Term was successfully updated.'
+  rescue => e
+    @term.errors.add(:target_term, e) if****@term*****?
+    render action: "edit"
   end
 
   def destroy
     @term = Term.find(params[:id])
     @user_glossary.delete(@term)
     redirect_to user_glossary_path(current_user, @user_glossary), notice: 'Term was successfully destroyed.'
+  rescue => e
+    redirect_to user_glossary_path(current_user, @user_glossary), notice: e.to_s
   end
 
   private
-------------- next part --------------
An HTML attachment was scrubbed...
下載 



More information about the logaling-commit mailing list
Back to archive index