Module: Ddr::Models::Relation

Included in:
Base
Defined in:
lib/ddr/models/relation.rb

Overview

Since ActiveFedora does not yet (as of at least v9.9.1) have named scopes, this module extends Base and is included in AF::Relation for chainability.

Instance Method Summary collapse

Instance Method Details

#having_local_id(local_id) ⇒ Object



8
9
10
# File 'lib/ddr/models/relation.rb', line 8

def having_local_id(local_id)
  where(Ddr::Index::Fields::LOCAL_ID => local_id)
end

#in_collection(coll) ⇒ Object



12
13
14
# File 'lib/ddr/models/relation.rb', line 12

def in_collection(coll)
  where(Ddr::Index::Fields::IS_MEMBER_OF_COLLECTION => coll.respond_to?(:id) ? coll.id : coll)
end