lib/sdb/active_sdb.rb
# Reload a set of attributes from SDB. Adds the loaded list to in-memory data.
# +attrs_list+ is an array or comma separated list of attributes names.
# Returns a hash of loaded attributes.
# 
# This is not the best method to get a bunch of attributes because
# a web service call is being performed for every attribute.
# 
#  item = Client.find_by_name('Cat')
#  item.reload_attributes('toys', 'name')   #=> {"name"=>["Cat"], "toys"=>["Jons socks", "clew", "mice"]}
#
Reload a set of attributes from SDB. Adds the loaded list to in-memory data.
+attrs_list+ is an array or comma separated list of attributes names.
Returns a hash of loaded attributes.

This is not the best method to get a bunch of attributes because
a web service call is being performed for every attribute.


Reload a set of attributes from SDB . Adds the loaded list to in - memory data . + attrs_list + is an array or comma separated list of attributes names . Returns a hash of loaded attributes . This is not the best method to get a bunch of attributes because a web service call is being performed for every attribute .
def reload_attributes(*attrs_list)
        raise_on_id_absence
        attrs_list = attrs_list.flatten.map{ |attribute| attribute.to_s }
        attrs_list.delete('id')
        result = {}
        attrs_list.flatten.uniq.each do |attribute|
          attribute = attribute.to_s
          values = connection.get_attributes(domain, id, attribute)[:attributes][attribute]
          unless values.right_blank?
            @attributes[attribute] = result[attribute] = values
          else
            @attributes.delete(attribute)
          end
        end
        mark_as_old
        result
      end
def reload_attributes ( * attrs_list ) raise_on_id_absence attrs_list = attrs_list . flatten . map { | attribute | attribute . to_s } attrs_list . delete ( 'id' ) result = { } attrs_list . flatten . uniq . each do | attribute | attribute = attribute . to_s values = connection . get_attributes ( domain , id , attribute ) [ :attributes ] [ attribute ] unless values . right_blank? @attributes [ attribute ] = result [ attribute ] = values else @attributes . delete ( attribute ) end end mark_as_old result end
Reload a set of attributes from SDB.
Reload a set of attributes from SDB .
attrs_list
<not_specific>