[logaling-commit] logaling/logaling-server [prioritize-the-search] Move SearchesController#glossary to user_config#glossary

Zurück zum Archiv-Index

SUZUKI Miho null+****@clear*****
Mon Sep 24 16:36:41 JST 2012


SUZUKI Miho	2012-09-24 16:36:41 +0900 (Mon, 24 Sep 2012)

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

  Log:
    Move SearchesController#glossary to user_config#glossary

  Modified files:
    app/controllers/search_controller.rb
    app/models/user_config.rb

  Modified: app/controllers/search_controller.rb (+2 -14)
===================================================================
--- app/controllers/search_controller.rb    2012-09-24 16:25:22 +0900 (7e2b7cb)
+++ app/controllers/search_controller.rb    2012-09-24 16:36:41 +0900 (77137a8)
@@ -2,20 +2,8 @@ class SearchController < ApplicationController
   def index
     @query = params[:query]
 
-    @terms = LogalingServer.repository.lookup(@query, glossary)
-    logge****@terms*****
-  end
-
-  private
-  def glossary
     user_config = signed_in? ? UserConfig.find_by_user_id(current_user.id) : nil
-    if user_config
-      LogalingServer.repository.find_glossary(
-        user_config.glossary_name,
-        user_config.source_language,
-        user_config.target_language)
-    else
-      nil
-    end
+    glossary = user_config ? user_config.glossary : nil
+    @terms = LogalingServer.repository.lookup(@query, glossary)
   end
 end

  Modified: app/models/user_config.rb (+4 -0)
===================================================================
--- app/models/user_config.rb    2012-09-24 16:25:22 +0900 (691a4f1)
+++ app/models/user_config.rb    2012-09-24 16:36:41 +0900 (66d9be9)
@@ -16,6 +16,10 @@ class UserConfig < ActiveRecord::Base
     target_language == user_glossary.target_language
   end
 
+  def glossary
+    LogalingServer.repository.find_glossary(glossary_name, source_language, target_language)
+  end
+
   private
   def id_to_config(id)
     id.split(".", 3)
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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