Skip to content

Filter associations should have a count method. #76

Open
@jcoyne

Description

Got this error:

Video.find('1544bp08d').generic_files.count
Attempted to init base path `prod`, but it already exists
RuntimeError: No :inverse_of or :predicate attribute was set or could be inferred for filter :generic_files on Video
    from /opt/goldenseal/shared/bundle/ruby/2.2.0/gems/active-fedora-9.4.0/lib/active_fedora/associations/collection_association.rb:341:in `find_reflection'
    from /opt/goldenseal/shared/bundle/ruby/2.2.0/gems/active-fedora-9.4.0/lib/active_fedora/associations/collection_association.rb:296:in `construct_query'
    from /opt/goldenseal/shared/bundle/ruby/2.2.0/gems/active-fedora-9.4.0/lib/active_fedora/associations/collection_association.rb:232:in `count'
    from /opt/goldenseal/shared/bundle/ruby/2.2.0/gems/active-fedora-9.4.0/lib/active_fedora/associations/collection_proxy.rb:676:in `count'


Video.find('1544bp08d').association(:generic_files)
=> #<ActiveFedora::Filter::Association:0x000000094d3970 @reflection=#<ActiveFedora::Filter::Reflection:0x00000009c190b8 @active_fedora=Video, @options={:condition=>:works_generic_file?, :extending_from=>:members}, @name=:generic_files, @macro=:filter, @automatic_inverse_of=false, @collection=false, @extending_from=#<ActiveFedora::Aggregation::Reflection:0x00000009bfaa00 @active_fedora=Video, @options={:predicate=>#<RDF::Vocabulary::Term:0x30dde48 URI:http://pcdm.org/models#hasMember>, :class_name=>"ActiveFedora::Base", :type_validator=>#<Hydra::PCDM::Validators::CompositeValidator:0x00000009bfab90 @validators=[Hydra::PCDM::Validators::PCDMObjectValidator, Hydra::PCDM::Validators::PCDMValidator, Hydra::PCDM::Validators::AncestorValidator]>}, @name=:members, @macro=:aggregation, @automatic_inverse_of=false, @collection=false, @class_name="ActiveFedora::Base", @klass=ActiveFedora::Base>, @class_name="GenericFile">, @owner=#<Video id: "1544bp08d", representative: nil, owner: nil, label: nil, depositor: "mark", relative_path: nil, import_url: nil, part_of: [], resource_type: [], title: ["Testing 44 minute video"], creator: [], contributor: [], description: [], tag: [], rights: ["http://www.europeana.eu/portal/rights/rr-r.html"], publisher: [], date_created: [], date_uploaded: Wed, 16 Sep 2015 16:31:50 +0000, date_modified: Wed, 16 Sep 2015 16:31:50 +0000, subject: [], language: [], identifier: [], based_near: [], related_url: [], bibliographic_citation: [], source: [], date_issued: "", extent: [], series: [], note: [], publication_place: [], description_standard: [], editor: [], sponsor: [], funder: [], researcher: [], head_id: nil, tail_id: nil, embargo_id: nil, lease_id: nil, tei_id: nil>, @loaded=false, @target=[], @stale_state=nil, @inversed=false>

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions