[logaling-commit] logaling/logaling-server [github-project-related-to-user] Rename user_config.glossary to user_config.glossary_name

Back to archive index

SUZUKI Miho null+****@clear*****
Mon Sep 24 16:25:22 JST 2012


SUZUKI Miho	2012-09-24 16:25:22 +0900 (Mon, 24 Sep 2012)

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

  Merged 971b851: Merge pull request #14 from logaling/prioritize-the-search

  Log:
    Rename user_config.glossary to user_config.glossary_name

  Added files:
    db/migrate/20120924072013_rename_column_of_user_config.rb
  Modified files:
    app/controllers/search_controller.rb
    app/models/user_config.rb
    db/schema.rb

  Modified: app/controllers/search_controller.rb (+1 -1)
===================================================================
--- app/controllers/search_controller.rb    2012-09-24 11:09:00 +0900 (d6c12fe)
+++ app/controllers/search_controller.rb    2012-09-24 16:25:22 +0900 (7e2b7cb)
@@ -11,7 +11,7 @@ class SearchController < ApplicationController
     user_config = signed_in? ? UserConfig.find_by_user_id(current_user.id) : nil
     if user_config
       LogalingServer.repository.find_glossary(
-        user_config.glossary,
+        user_config.glossary_name,
         user_config.source_language,
         user_config.target_language)
     else

  Modified: app/models/user_config.rb (+4 -4)
===================================================================
--- app/models/user_config.rb    2012-09-24 11:09:00 +0900 (c54c6db)
+++ app/models/user_config.rb    2012-09-24 16:25:22 +0900 (691a4f1)
@@ -1,17 +1,17 @@
 class UserConfig < ActiveRecord::Base
-  attr_accessible :glossary, :source_language, :target_language, :user_id
+  attr_accessible :glossary_name, :source_language, :target_language, :user_id
 
-  validates_presence_of :glossary, :source_language, :target_language, :user_id
+  validates_presence_of :glossary_name, :source_language, :target_language, :user_id
 
   belongs_to :user
 
   def set_config(params)
     self.user_id ||= params[:user_id]
-    self.glossary, self.source_language, self.target_language = id_to_config(params[:id])
+    self.glossary_name, self.source_language, self.target_language = id_to_config(params[:id])
   end
 
   def same?(user_glossary)
-    glossary == user_glossary.glossary_name &&
+    glossary_name == user_glossary.glossary_name &&
     source_language == user_glossary.source_language &&
     target_language == user_glossary.target_language
   end

  Added: db/migrate/20120924072013_rename_column_of_user_config.rb (+9 -0) 100644
===================================================================
--- /dev/null
+++ db/migrate/20120924072013_rename_column_of_user_config.rb    2012-09-24 16:25:22 +0900 (fb894e8)
@@ -0,0 +1,9 @@
+class RenameColumnOfUserConfig < ActiveRecord::Migration
+  def up
+    rename_column :user_configs, :glossary, :glossary_name
+  end
+
+  def down
+    rename_column :user_configs, :glossary_name, :glossary
+  end
+end

  Modified: db/schema.rb (+2 -2)
===================================================================
--- db/schema.rb    2012-09-24 11:09:00 +0900 (0af3122)
+++ db/schema.rb    2012-09-24 16:25:22 +0900 (312f0ac)
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version => 20120921055727) do
+ActiveRecord::Schema.define(:version => 20120924072013) do
 
   create_table "github_projects", :force => true do |t|
     t.string   "owner"
@@ -21,7 +21,7 @@ ActiveRecord::Schema.define(:version => 20120921055727) do
   end
 
   create_table "user_configs", :force => true do |t|
-    t.string   "glossary"
+    t.string   "glossary_name"
     t.string   "source_language"
     t.string   "target_language"
     t.datetime "created_at",      :null => false
-------------- next part --------------
An HTML attachment was scrubbed...
다운로드 



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