def sdb_to_ruby(name, value)
#            puts 'sdb_to_ruby arg=' + name.inspect + ' - ' + name.class.name + ' - value=' + value.to_s
      return nil if value.nil?
      att_meta = get_att_meta(name)

      if att_meta.options
        if att_meta.options[:encrypted]
          value = Translations.decrypt(value, att_meta.options[:encrypted])
        end
        if att_meta.options[:hashed]
          return PasswordHashed.new(value)
        end
      end


      if !has_id_on_end(name) && att_meta.type == :belongs_to
        class_name = att_meta.options[:class_name] || name.to_s[0...1].capitalize + name.to_s[1...name.to_s.length]
        # Camelize classnames with underscores (ie my_model.rb --> MyModel)
        class_name = class_name.camelize
        #      puts "attr=" + @attributes[arg_id].inspect
        #      puts 'val=' + @attributes[arg_id][0].inspect unless @attributes[arg_id].nil?
        ret        = nil
        arg_id     = name.to_s + '_id'
        arg_id_val = send("#{arg_id}")
        if arg_id_val
          if !cache_store.nil?
#                        arg_id_val = @attributes[arg_id][0]
            cache_key = self.class.cache_key(class_name, arg_id_val)
#          puts 'cache_key=' + cache_key
            ret       = cache_store.read(cache_key)
#          puts 'belongs_to incache=' + ret.inspect
          end
          if ret.nil?
            to_eval = "#{class_name}.find('#{arg_id_val}')"
#      puts 'to eval=' + to_eval
            begin
              ret = eval(to_eval) # (defined? #{arg}_id)
            rescue SimpleRecord::ActiveSdb::ActiveSdbError => ex
              if ex.message.include? "Couldn't find"
                ret = RemoteNil.new
              else
                raise ex
              end
            end

          end
        end
        value = ret
      else
        if value.is_a? Array
          value = value.collect { |x| string_val_to_ruby(att_meta, x) }
        else
          value = string_val_to_ruby(att_meta, value)
        end
      end
      value
    end
def sdb_to_ruby(name, value)
#            puts 'sdb_to_ruby arg=' + name.inspect + ' - ' + name.class.name + ' - value=' + value.to_s
      return nil if value.nil?
      att_meta = get_att_meta(name)

      if att_meta.options
        if att_meta.options[:encrypted]
          value = Translations.decrypt(value, att_meta.options[:encrypted])
        end
        if att_meta.options[:hashed]
          return PasswordHashed.new(value)
        end
      end


      if !has_id_on_end(name) && att_meta.type == :belongs_to
        class_name = att_meta.options[:class_name] || name.to_s[0...1].capitalize + name.to_s[1...name.to_s.length]
        # Camelize classnames with underscores (ie my_model.rb --> MyModel)
        class_name = class_name.camelize
        #      puts "attr=" + @attributes[arg_id].inspect
        #      puts 'val=' + @attributes[arg_id][0].inspect unless @attributes[arg_id].nil?
        ret        = nil
        arg_id     = name.to_s + '_id'
        arg_id_val = send("#{arg_id}")
        if arg_id_val
          if !cache_store.nil?
#                        arg_id_val = @attributes[arg_id][0]
            cache_key = self.class.cache_key(class_name, arg_id_val)
#          puts 'cache_key=' + cache_key
            ret       = cache_store.read(cache_key)
#          puts 'belongs_to incache=' + ret.inspect
          end
          if ret.nil?
            to_eval = "#{class_name}.find('#{arg_id_val}')"
#      puts 'to eval=' + to_eval
            begin
              ret = eval(to_eval) # (defined? #{arg}_id)
            rescue SimpleRecord::ActiveSdb::ActiveSdbError => ex
              if ex.message.include? "Couldn't find"
                ret = RemoteNil.new
              else
                raise ex
              end
            end

          end
        end
        value = ret
      else
        if value.is_a? Array
          value = value.collect { |x| string_val_to_ruby(att_meta, x) }
        else
          value = string_val_to_ruby(att_meta, value)
        end
      end
      value
    end
Convert value from SimpleDB String version to real ruby value.