Sha256: 637e3e88bca8722164769a5db46ffe0bb35a9d239d73817c8e252b8d48d7b324

Contents?: true

Size: 844 Bytes

Versions: 10

Compression:

Stored size: 844 Bytes

Contents

module CurationConcern
  module WithRelatedWorks
    extend ActiveSupport::Concern

    included do
      # Should use somethign like http://purl.org/dc/elements/1.1/relation
      # -- waiting for ability to modify AF predicates (which is in another branch right now).  Using :has_member until then.
      has_and_belongs_to_many :related_works, property: :has_member, class_name:"ActiveFedora::Base"
      has_many :referenced_by_works, property: :has_member, class_name:"ActiveFedora::Base"

      #attr_accessible :related_work_tokens
      accepts_nested_attributes_for :related_works, :allow_destroy => true

      def related_work_tokens=(tokens)
        self.related_work_ids = CurationConcern::Work.ids_from_tokens(tokens)
      end

      def related_work_tokens
        self.related_work_ids.join(", ")
      end

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
curate-0.6.6 app/repository_models/curation_concern/with_related_works.rb
curate-0.6.5 app/repository_models/curation_concern/with_related_works.rb
curate-0.6.4 app/repository_models/curation_concern/with_related_works.rb
curate-0.6.3 app/repository_models/curation_concern/with_related_works.rb
curate-0.6.1 app/repository_models/curation_concern/with_related_works.rb
curate-0.6.0 app/repository_models/curation_concern/with_related_works.rb
curate-0.5.6 app/repository_models/curation_concern/with_related_works.rb
curate-0.5.5 app/repository_models/curation_concern/with_related_works.rb
curate-0.5.4 app/repository_models/curation_concern/with_related_works.rb
curate-0.5.2 app/repository_models/curation_concern/with_related_works.rb