lib/knj/translations.rb in knjrbfw-0.0.7 vs lib/knj/translations.rb in knjrbfw-0.0.8

- old
+ new

@@ -41,11 +41,11 @@ "locale" => locale }) return "" if trans.empty? trans.each do |tran| - if !@cache.has_key?(classn) + if !@cache.key?(classn) @cache[classn] = { objid => { key => { locale => tran } @@ -107,33 +107,18 @@ }) trans.each do |tran| @ob.delete(tran) end - @cache[classn].delete(objid) if @cache.has_key?(classn) and @cache.has_key?(objid) + @cache[classn].delete(objid) if @cache.key?(classn) and @cache.key?(objid) end end class Knj::Translations::Translation < Knj::Datarow def self.add(d) if d.data[:object] d.data[:object_class] = d.data[:object].class.name d.data[:object_id] = d.data[:object].id d.data.delete(:object) end - end - - def self.list(d) - sql = "SELECT * FROM #{d.db.escape_col}#{d.db.esc_col(table)}#{d.db.escape_col} WHERE 1=1" - ret = list_helper(d) - - d.args.each do |key, val| - raise "No such key: #{key}." - end - - sql += ret[:sql_where] - sql += ret[:sql_order] - sql += ret[:sql_limit] - - return d.ob.list_bysql(:Translation, sql) end end \ No newline at end of file