Willy Mene
unread,Nov 5, 2009, 3:24:30 PM11/5/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to active...@googlegroups.com
We would like to have a default value for one of our fields in a
MetadataDatastream.
My first attempt at this was to set the value of that particular field
in the objects initializer, but found any existing values in Fedora
were being appended to the default. Digging through the code, I found
that ActiveFedora::Base objects are initialized, then the datastream
xml is parsed, and then the values are appended to whatever is in
memory. This is done through:
ActiveFedora::Base#deserialize and
ActiveFedora::MetadataDatastream#from_xml
So instead of re-writing/overriding these methods, I wanted to see if
there was interest in having default values in MetadataDatastreams as
a new feature. It could go something like this:
class MyObj < ActiveFedora::Base
has_metadata :name => "my_properties", :type =>
ActiveFedora::MetadataDatastream do |m|
m.field "some_field", :string, :default_value => 'some default value'
...
end
...
end
Any thoughts?
Willy