[logaling-commit] logaling/logaling-server [master] Use Term.new for build object from hash

Zurück zum Archiv-Index

SHIMADA Koji null+****@clear*****
Thu Sep 20 10:47:51 JST 2012


SHIMADA Koji	2012-09-20 10:47:51 +0900 (Thu, 20 Sep 2012)

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

  Merged c5d082c: Merge pull request #13 from logaling/enable-creating-user-glossary

  Log:
    Use Term.new for build object from hash

  Modified files:
    app/models/term.rb
    app/models/user_glossary.rb

  Modified: app/models/term.rb (+0 -9)
===================================================================
--- app/models/term.rb    2012-09-20 10:33:45 +0900 (acff1e0)
+++ app/models/term.rb    2012-09-20 10:47:51 +0900 (f2d1c1a)
@@ -1,15 +1,6 @@
 #coding: utf-8
 class Term
   class << self
-    def set_value(hash_value)
-      hash = hash_value.with_indifferent_access
-      term = Term.new
-      self.attributes.each do |key, value|
-        term[key] = hash[key] if hash[key].present?
-      end
-      term
-    end
-
     def find(id)
       source_term, target_term = id_to_source_term_and_target_term(id)
       Term.new do |t|

  Modified: app/models/user_glossary.rb (+1 -1)
===================================================================
--- app/models/user_glossary.rb    2012-09-20 10:33:45 +0900 (820de5a)
+++ app/models/user_glossary.rb    2012-09-20 10:47:51 +0900 (e4b0d20)
@@ -58,7 +58,7 @@ class UserGlossary < ActiveRecord::Base
   def terms(annotation=nil)
     glossary = find_glossary
     raise Logaling::GlossaryNotFound unless glossary
-    terms = glossary.terms(annotation).map { |term_hash| Term.set_value(term_hash) }
+    terms = glossary.terms(annotation).map { |term_attrs| Term.new(term_attrs) }
   end
 
   private
-------------- next part --------------
An HTML attachment was scrubbed...
Download 



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