class ActiveFedora::Base
def update_attributes(params={}, opts={})
or
m.update_attributes({:fubar=>'baz'}, :datastreams=>"my_ds")
use the :datastreams argument like so:
If you want to specify which datastream(s) to update,
are _both_ overwritten.
the object's datastreams. This means DS1.fubar_values and DS2.fubar_values
This will attempt to set the values for any fields named fubar in any of
m.update_attributes(:fubar=>'baz')
Example Usage:
An ActiveRecord-ism to udpate metadata values.
def update_attributes(params={}, opts={}) params.each do |k,v| if v == :delete || v == "" || v == nil v = [] end if opts[:datastreams] ds_array = [] opts[:datastreams].each do |dsname| ds_array << datastreams[dsname] end else ds_array = datastreams.values end ds_array.each do |d| if d.fields[k.to_sym] d.send("#{k}_values=", v) end end end end