class ActiveFedora::Base
def update_indexed_attributes(params={}, opts={})
m.update_attributes({"fubar"=>{"-1"=>"mork", "0"=>"york", "1"=>"mangle"}}, :datastreams=>["my_ds", "my_other_ds"])
or
m.update_attributes({"fubar"=>{"-1"=>"mork", "0"=>"york", "1"=>"mangle"}}, :datastreams=>"my_ds")
use the :datastreams argument like so:
If you want to specify which datastream(s) to update,
As in update_attributes, this overwrites _all_ available fields by default.
will be overwritten.
An index of -1 will insert a new value. any existing value at the relevant index
This will result in any datastream field of name :name having the value [a,b]
{{:name=>{"0"=>"a","1"=>"b"}}
must look like this :
A convenience method for updating indexed attributes. The passed in hash
def update_indexed_attributes(params={}, opts={}) if ds = opts[:datastreams] ds_array = [] ds = [ds] unless ds.respond_to? :each ds.each do |dsname| ds_array << datastreams[dsname] end else ds_array = metadata_streams end result = {} ds_array.each do |d| result[d.dsid] = d.update_indexed_attributes(params,opts) end return result end