Sha256: 951fb161078f13097cf5a3b5aec8cd175748d0d8e4d12cd1230eb63423576be5

Contents?: true

Size: 894 Bytes

Versions: 14

Compression:

Stored size: 894 Bytes

Contents

class Dataset < ActiveFedora::Base

  class DatastreamMetadata < ActiveFedora::NokogiriDatastream

    ##
    # Here's the important part. We're mapping XML into Ruby.
    set_terminology do |t|
      t.root :path => 'root', :xmlns => nil
      t.title
      t.author
      t.url
      t.description
    end

    def self.xml_template
      Nokogiri::XML::Builder.new do |xml|
        xml.root do
          xml.title
          xml.author
          xml.url
          xml.description
        end
      end.doc
    end
  end

  include Hydra::ModelMixins::CommonMetadata
  include Hydra::ModelMethods

  has_metadata :name => "descMetadata", :type => DatastreamMetadata

  delegate :title, :to=>'descMetadata', :unique=>true
  delegate :author, :to=>'descMetadata', :unique=>true
  delegate :url, :to=>'descMetadata', :unique=>true
  delegate :description, :to=>'descMetadata', :unique=>true

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hydra-tutorial-0.2.1 old_tutorial/templates/application/dataset_hydra_om.rb
hydra-tutorial-0.2.0 old_tutorial/templates/application/dataset_hydra_om.rb
hydra-tutorial-0.1.3 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.1.2 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.1.0 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.9 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.8 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.7 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.6 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.5 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.4 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.3 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.2 templates/application/dataset_hydra_om.rb
hydra-tutorial-0.0.1 templates/application/dataset_hydra_om.rb