[logaling-commit] logaling/logaling-server [enable-removing-user-glossary] Remove personal glossary file when user_glossary was removed

Zurück zum Archiv-Index

SUZUKI Miho null+****@clear*****
Thu Sep 27 14:58:22 JST 2012


SUZUKI Miho	2012-09-27 14:58:22 +0900 (Thu, 27 Sep 2012)

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

  Log:
    Remove personal glossary file when user_glossary was removed

  Modified files:
    app/models/user_glossary.rb

  Modified: app/models/user_glossary.rb (+6 -0)
===================================================================
--- app/models/user_glossary.rb    2012-09-27 14:44:30 +0900 (5a8ce0c)
+++ app/models/user_glossary.rb    2012-09-27 14:58:22 +0900 (51d5045)
@@ -17,6 +17,7 @@ class UserGlossary < ActiveRecord::Base
   validates_uniqueness_of :name, scope: [:user_id, :source_language, :target_language]
 
   after_create :create_personal_project!
+  after_destroy :remove_personal_project!
 
   scope :with_name, lambda {|name|
     where(name: name)
@@ -95,4 +96,9 @@ class UserGlossary < ActiveRecord::Base
     LogalingServer.repository.create_personal_project(glossary_name, source_language, target_language)
     LogalingServer.repository.index
   end
+
+  def remove_personal_project!
+    LogalingServer.repository.remove_personal_project(glossary_name, source_language, target_language)
+    LogalingServer.repository.index
+  end
 end
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



More information about the logaling-commit mailing list
Zurück zum Archiv-Index